function ctools_object_cache_set in Chaos Tool Suite (ctools) 6
Same name and namespace in other branches
- 7 includes/object-cache.inc \ctools_object_cache_set()
Store an object in the non-volatile ctools cache.
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.
$cache: The object to be cached. This will be serialized prior to writing.
6 calls to ctools_object_cache_set()
- ctools_ajax_sample_cache_set in ctools_ajax_sample/
ctools_ajax_sample.module - Store our little cache so that we can retain data from form to form.
- ctools_context_cache_set in includes/
context-admin.inc - Get the cache for the context object.
- ctools_export_ui::edit_cache_set_key in plugins/
export_ui/ ctools_export_ui.class.php - ctools_stylizer_set_settings_cache in includes/
stylizer.inc - Store changes to a task handler in the object cache.
- page_manager_set_page_cache in page_manager/
page_manager.module - Store changes to a task handler in the object cache.
File
- includes/
object-cache.inc, line 56 - 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_set($obj, $name, $cache) {
// Store the CTools session id in the user session to force a
// session for anonymous users in Drupal 7 and Drupal 6 Pressflow.
// see http://drupal.org/node/562374, http://drupal.org/node/861778
if (empty($GLOBALS['user']->uid) && empty($_SESSION['ctools_session_id'])) {
$_SESSION['ctools_hold_session'] = TRUE;
}
ctools_object_cache_clear($obj, $name);
db_query("INSERT INTO {ctools_object_cache} (sid, obj, name, data, updated) VALUES ('%s', '%s', '%s', %b, %d)", session_id(), $obj, $name, serialize($cache), time());
}