function ctools_object_cache_get in Chaos Tool Suite (ctools) 6
Same name and namespace in other branches
- 7 includes/object-cache.inc \ctools_object_cache_get()
Get an object from the non-volatile ctools 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 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.
6 calls to ctools_object_cache_get()
- ctools_ajax_sample_cache_get in ctools_ajax_sample/
ctools_ajax_sample.module - Get the current object from the cache, or default.
- ctools_context_cache_get in includes/
context-admin.inc - Get the cache for the context object.
- ctools_export_ui::edit_cache_get in plugins/
export_ui/ ctools_export_ui.class.php - Retrieve the item currently being edited from the object cache.
- ctools_stylizer_get_settings_cache in includes/
stylizer.inc - Get the cached changes to a given task handler.
- page_manager_get_page_cache in page_manager/
page_manager.module - Get the cached changes to a given task handler.
2 string references to 'ctools_object_cache_get'
- ctools_object_cache_clear in includes/
object-cache.inc - Remove an object from the non-volatile ctools cache
- ctools_object_cache_clear_all in includes/
object-cache.inc - Remove an object from the non-volatile ctools cache for all session IDs.
File
- includes/
object-cache.inc, line 29 - The non-volatile object cache is used to store an object while it is being edited, so that we don't have to save until we're completely done. The cache should be 'cleaned' on a regular basis, meaning to remove old objects from the…
Code
function ctools_object_cache_get($obj, $name, $skip_cache = FALSE) {
$cache =& ctools_static(__FUNCTION__, array());
$key = "{$obj}:{$name}";
if ($skip_cache) {
unset($cache[$key]);
}
if (!array_key_exists($key, $cache)) {
$data = db_fetch_object(db_query("SELECT * FROM {ctools_object_cache} WHERE sid = '%s' AND obj = '%s' AND name = '%s'", session_id(), $obj, $name));
if ($data) {
$cache[$key] = unserialize(db_decode_blob($data->data));
}
}
return isset($cache[$key]) ? $cache[$key] : NULL;
}