function ctools_object_cache_get

cis7 object-cache.inc ctools_object_cache_get($obj, $name, $skip_cache = FALSE, $sid = NULL)
cle7 object-cache.inc ctools_object_cache_get($obj, $name, $skip_cache = FALSE, $sid = NULL)
elmsmedia7 object-cache.inc ctools_object_cache_get($obj, $name, $skip_cache = FALSE, $sid = NULL)
icor7 object-cache.inc ctools_object_cache_get($obj, $name, $skip_cache = FALSE, $sid = NULL)
meedjum_blog7 object-cache.inc ctools_object_cache_get($obj, $name, $skip_cache = FALSE, $sid = NULL)
mooc7 object-cache.inc ctools_object_cache_get($obj, $name, $skip_cache = FALSE, $sid = NULL)

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 128 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.

$sid: The session id, allowing someone to use Session API or their own solution; defaults to session_id().

Return value

The data that was cached.

Deprecated

$skip_cache is deprecated in favor of drupal_static*

9 calls to ctools_object_cache_get()
ctools_ajax_sample_cache_get in sites/all/modules/ulmus/ctools/ctools_ajax_sample/ctools_ajax_sample.module
Get the current object from the cache, or default.
ctools_cache_simple_cache_get in sites/all/modules/ulmus/ctools/plugins/cache/simple.inc
ctools_export_ui::edit_cache_get in sites/all/modules/ulmus/ctools/plugins/export_ui/ctools_export_ui.class.php
Retrieve the item currently being edited from the object cache.
ctools_stylizer_get_settings_cache in sites/all/modules/ulmus/ctools/includes/stylizer.inc
Get the cached changes to a given task handler.
ds_ctools_content in sites/all/modules/ulmus/ds/includes/ds.field_ui.inc
Return the configuration settings for the CTools field.

... See full list

2 string references to 'ctools_object_cache_get'
ctools_object_cache_clear in sites/all/modules/ulmus/ctools/includes/object-cache.inc
Remove an object from the non-volatile ctools cache
ctools_object_cache_clear_all in sites/all/modules/ulmus/ctools/includes/object-cache.inc
Remove an object from the non-volatile ctools cache for all session IDs.

File

sites/all/modules/ulmus/ctools/includes/object-cache.inc, line 33
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, $sid = NULL) {
  $cache = &drupal_static(__FUNCTION__, array());
  $key = "$obj:$name";
  if ($skip_cache) {
    unset($cache[$key]);
  }

  if (!$sid) {
    $sid = session_id();
  }

  if (!array_key_exists($key, $cache)) {
    $data = db_query('SELECT * FROM {ctools_object_cache} WHERE sid = :session_id AND obj = :object AND name = :name', array(':session_id' => $sid, ':object' => $obj, ':name' => $name))->fetchObject();
    if ($data) {
      $cache[$key] = unserialize($data->data);
    }
  }
  return isset($cache[$key]) ? $cache[$key] : NULL;
}