You are here

public static function QPCache::get in QueryPath 6

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

Return the value of the given key, if it exists in the database.

If no value is found, this will return NULL.

2 calls to QPCache::get()
qpcache_get in qpcache/qpcache.module
Retrieve an object from the cache.
qpcache_qp in qpcache/qpcache.module
Factory for creating a QueryPath object.

File

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

Class

QPCache
This is a special-purpose XML cache.

Code

public static function get($key) {
  list($crc, $hash) = self::genMultiKey($key);
  $now = time();

  // if (is_array($key)) {
  //       drupal_set_message('Retrieval key is array.', 'status');
  //     }
  $sql = 'SELECT clearkey, expire, body FROM {qpcache_xmlcache} WHERE crckey=%d AND hashkey=\'%s\' AND (expire = 0 OR expire > %d)';
  $object = db_fetch_object(db_query($sql, $crc, $hash, $now));
  if (empty($object)) {
    return;
  }
  $object->xml = $object->body;
  return $object;
}