You are here

public static function QPCache::has in QueryPath 7.2

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

Return true if the cache has this key.

1 call to QPCache::has()
qpcache_has in qpcache/qpcache.module
Check if given key exists.

File

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

Class

QPCache
This is a special-purpose XML cache.

Code

public static function has($key) {
  list($crc, $hash) = self::genMultiKey($key);
  $now = time();
  $sql = 'SELECT 1 FROM {qpcache_xmlcache} WHERE crckey=:crc AND hashkey=\':hash\' AND (expire = 0 OR expire > :now)';
  return (bool) db_query_range($sql, 0, 1, array(
    ':crc' => $crc,
    ':hash' => $hash,
    ':now' => $now,
  ));
}