You are here

function ctools_object_cache_test in Chaos Tool Suite (ctools) 6

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

Determine if another user has a given object cached.

This is very useful for 'locking' objects so that only one user can modify them.

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

Return value

An object containing the UID and updated date if found; NULL if not.

1 call to ctools_object_cache_test()
page_manager_get_page_cache in page_manager/page_manager.module
Get the cached changes to a given task handler.

File

includes/object-cache.inc, line 100
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($obj, $name) {
  return db_fetch_object(db_query("SELECT s.uid, c.updated FROM {ctools_object_cache} c INNER JOIN {sessions}  s ON c.sid = s.sid WHERE s.sid != '%s' AND c.obj = '%s' AND c.name = '%s' ORDER BY c.updated ASC", session_id(), $obj, $name));
}