function cache_get in File Cache 5.5
Return data from the persistent cache.
Parameters
$key: The cache ID of the data to retrieve.
$table: The table $table to store the data in. Valid core values are 'cache_filter', 'cache_menu', 'cache_page', or 'cache' for the default cache.
File
- ./
filecache.inc, line 12
Code
function cache_get($key, $table = 'cache') {
global $user;
$src = variable_get('filecache_path', 'files/cache') . '/' . $table . '/' . urlencode($cid);
if (!file_exists($src)) {
return 0;
}
$cache = unserialize(file_get_contents($src));
if (isset($cache->data)) {
// If the data is permanent or we're not enforcing a minimum cache lifetime
// always return the cached data.
if ($cache->expire == CACHE_PERMANENT || !variable_get('cache_lifetime', 0)) {
$cache->data = db_decode_blob($cache->data);
}
else {
if ($user->cache > $cache->created) {
// This cache data is too old and thus not valid for us, ignore it.
return 0;
}
else {
$cache->data = db_decode_blob($cache->data);
}
}
return $cache;
}
return 0;
}