You are here

function _qpcache_format_key in QueryPath 6

Same name and namespace in other branches
  1. 7.3 qpcache/qpcache.module \_qpcache_format_key()
  2. 7.2 qpcache/qpcache.module \_qpcache_format_key()

Convenience function for preparing a key.

Keys can be objects or arrays, but in such cases we need to do some special preparation before using these.

3 calls to _qpcache_format_key()
qpcache_get in qpcache/qpcache.module
Retrieve an object from the cache.
qpcache_remove in qpcache/qpcache.module
Remove an item from the cache.
qpcache_set in qpcache/qpcache.module
Set an object in the cache.

File

qpcache/qpcache.module, line 60
The main file for qpcache.

Code

function _qpcache_format_key($key) {
  if (is_resource($key)) {

    //drupal_set_message('Resource cannot be used as a key.', 'status');
    watchdog('qpcache', 'Resources cannot be used as keys.', array(), WATCHDOG_ERROR);
    return;
  }

  // Complex objects need to be serialized before they can be stored as
  // keys.
  if (is_array($key) || is_object($key)) {
    $key = serialize($key);
  }
  return $key;
}