function hacked_release_generate_hashes_cached in Hacked! 6
Same name and namespace in other branches
- 5 hacked.module \hacked_release_generate_hashes_cached()
1 call to hacked_release_generate_hashes_cached()
File
- ./
hacked.module, line 420 - 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 $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, $cached[$type][$short_name][$version], HACKED_CACHE_TABLE);
// Return the hashes:
return $cached[$type][$short_name][$version];
}