You are here

function ctools_object_cache_test_objects in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 includes/object-cache.inc \ctools_object_cache_test_objects()

Get the cache status of a group of objects.

This is useful for displaying lock status when listing a number of objects an an administration UI.

Parameters

$obj: A 32 character or less string to define what kind of object is being stored; primarily this is used to prevent collisions.

$names: An array of names of objects

Return value

An array of objects containing the UID and updated date for each name found.

1 call to ctools_object_cache_test_objects()
page_manager_list_page in page_manager/page_manager.admin.inc
Output a list of pages that are managed.

File

includes/object-cache.inc, line 119
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_test_objects($obj, $names) {
  $placeholders = db_placeholders($names, 'varchar');
  $args = array_merge(array(
    $obj,
  ), $names);
  $result = db_query("SELECT c.name, s.uid, c.updated FROM {ctools_object_cache} c INNER JOIN {sessions}  s ON c.sid = s.sid WHERE c.obj = '%s' AND c.name IN ({$placeholders}) ORDER BY c.updated ASC", $args);
  $return = array();
  while ($test = db_fetch_object($result)) {
    $return[$test->name] = $test;
  }
  return $return;
}