function views_object_cache_get
2.x cache.inc | views_object_cache_get($obj, $name, $skip_cache = FALSE) |
Get an object from the non-volatile Views cache.
This function caches in memory as well, so that multiple calls to this will not result in multiple database reads.
Parameters
$obj: A 32 character or less string to define what kind of object is being stored; primarily this is used to prevent collisions.
$name: The name of the view (or other object) being stored.
$skip_cache: Skip the memory cache, meaning this must be read from the db again.
Return value
The data that was cached.
Related topics
1 call to views_object_cache_get()
- views_ui_cache_load in ./
views_ui.module - Specialized menu callback to load a view either out of the cache or just load it.
File
Code
function views_object_cache_get($obj, $name, $skip_cache = FALSE) {
static $cache = array();
$key = "$obj:$name";
if ($skip_cache) {
unset($cache[$key]);
}
if (!array_key_exists($key, $cache)) {
$data = db_fetch_object(db_query("SELECT * FROM {views_object_cache} WHERE sid = '%s' AND obj = '%s' AND name = '%s'", session_id(), $obj, $name));
if ($data) {
$cache[$key] = unserialize($data->data);
}
}
return isset($cache[$key]) ? $cache[$key] : NULL;
}