| 4.6 bootstrap.inc | cache_set($cid, $data, $expire = CACHE_PERMANENT, $headers = NULL) |
| 4.7 bootstrap.inc | cache_set($cid, $data, $expire = CACHE_PERMANENT, $headers = NULL) |
| 5 cache.inc | cache_set( |
| 6 cacherouter.inc | cache_set( |
| 6 cache.inc | cache_set($cid, $data, $table = 'cache', $expire = CACHE_PERMANENT, $headers = NULL) |
| 6 cache-install.inc | cache_set($cid, $data, |
| 7 cache.inc | cache_set($cid, $data, $bin = 'cache', $expire = CACHE_PERMANENT) |
| 8 cache.inc | cache_set($cid, $data, $bin = 'cache', $expire = CACHE_PERMANENT) |
Store data in the persistent cache.
$cid: The cache ID of the data to store.
$data: The data to store in the cache. Complex data types must be serialized first.
$expire: One of the following values:
$headers: A string containing HTTP header information for cached pages.
function cache_set($cid, $data, $expire = CACHE_PERMANENT, $headers = NULL) {
$data = db_encode_blob($data);
db_query("UPDATE {cache} SET data = '%s', created = %d, expire = %d, headers = '%s' WHERE cid = '%s'", $data, time(), $expire, $headers, $cid);
if (!db_affected_rows()) {
@db_query("INSERT INTO {cache} (cid, data, created, expire, headers) VALUES ('%s', '%s', %d, %d, '%s')", $cid, $data, time(), $expire, $headers);
}
}