You are here

function qpcache_set in QueryPath 7.2

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

Set an object in the cache.

Cache this item. Optionally, you may set the expiration date.

Cache entries will replace existing records with the same key.

Parameters

$key: The cache key. This can be anything but a PHP resource. Typcically, unique strings are used. Since the storage engine optimizes the key for performance, there is no need to worry about key lengths or hashing or anything like that.

$body: The text content to cache.

$expire: The date on which this expires. Date can be in any format that strtotime() can parse (meaning you can do things like '+2 weeks'). If expire is set to 0 (the default) then the document will never be expired.

File

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

Code

function qpcache_set($key, $body, $expire = 0) {
  $key = _qpcache_format_key($key);
  if (!isset($key)) {
    return;
  }
  return QPCache::set($key, $body, $expire);
}