You are here

public static function QPCache::set in QueryPath 6

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

Put a value in the cache.

This will overwrite any existing entry with the same key.

Parameters

$key: A string value.

$body: The text value to store.

$expire: An expiration date in UNIX timestamp format.

2 calls to QPCache::set()
qpcache_qp in qpcache/qpcache.module
Factory for creating a QueryPath object.
qpcache_set in qpcache/qpcache.module
Set an object in the cache.

File

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

Class

QPCache
This is a special-purpose XML cache.

Code

public static function set($key, $body, $expire = 0) {
  list($crckey, $hashkey) = self::genMultiKey($key);

  // foreach (array($key, $body, $expire) as $f) {
  //       if (is_array($f)) {
  //         drupal_set_message('WARNING: Array: ' . print_r($f, TRUE), 'status');
  //       }
  //     }
  db_query("DELETE FROM {qpcache_xmlcache} WHERE hashkey = '%s'", $hashkey);
  db_query("INSERT INTO {qpcache_xmlcache} (crckey, hashkey, clearkey, body, expire) \n      VALUES (%d, '%s', '%s', '%s', %d)", $crckey, $hashkey, $key, $body, $expire);
}