You are here

function ctools_cache_operation in Chaos Tool Suite (ctools) 7

Perform a secondary operation on an indirect cache.

Additional operations, beyond get, set and clear may be items such as 'break' and 'finalize', which are needed to support cache locking. Other operations may be added by users of the indirect caching functions as needed.

Parameters

string $mechanism: A string containing the plugin name, and an optional data element to send to the plugin separated by two colons.

string $key: The key used to identify the cache.

string $op: The operation to call, such as 'break' or 'finalize'.

mixed $object: The cache data being operated on, in case it is necessary. This is optional so no references should be used.

Return value

mixed The operation may or may not return a value.

6 calls to ctools_cache_operation()
ctools_cache_clear in includes/cache.inc
Clear data from an indirect cache.
ctools_cache_get in includes/cache.inc
Fetch data from an indirect cache.
ctools_cache_set in includes/cache.inc
Store data in an indirect cache.
ctools_context_ajax_item_add in includes/context-admin.inc
Ajax entry point to add an context
ctools_context_ajax_item_delete in includes/context-admin.inc
Ajax entry point to edit an item

... See full list

File

includes/cache.inc, line 118
Plugins to handle cache-indirection.

Code

function ctools_cache_operation($mechanism, $key, $op, $object = NULL) {
  list($plugin, $data) = ctools_cache_find_plugin($mechanism);
  if (empty($plugin)) {
    return;
  }
  $function = ctools_plugin_get_function($plugin, "cache {$op}");
  if (empty($function)) {
    return;
  }
  return $function($data, $key, $object, $op);
}