function hacked_release_generate_hashes_cached in Hacked! 5
Same name and namespace in other branches
- 6 hacked.module \hacked_release_generate_hashes_cached()
1 call to hacked_release_generate_hashes_cached()
File
- ./
hacked.module, line 424 - The Hacked! module, shows which project have been changed since download.
Code
function hacked_release_generate_hashes_cached($type, $short_name, $version) {
static $cached = array();
// Return from the static cache if we can:
if (isset($cached[$type][$short_name][$version])) {
return $cached[$type][$short_name][$version];
}
// Return form the cache system if we can:
$key = "hacked:clean:hashes:{$type}:{$short_name}:{$version}";
$cache = cache_get($key, HACKED_CACHE_TABLE);
if ($cache && isset($cache->data)) {
return unserialize($cache->data);
}
// Otherwise pass through to the actual function:
$cached[$type][$short_name][$version] = hacked_release_generate_hashes($type, $short_name, $version);
// Save into the cache table:
cache_set($key, HACKED_CACHE_TABLE, serialize($cached[$type][$short_name][$version]));
// Return the hashes:
return $cached[$type][$short_name][$version];
}