_update_cache_set
- Versions
- 6 – 7
_update_cache_set($cid, $data, $expire)
Store data in the private update status cache table.
Note: this function completely ignores the {cache_update}.headers field since that is meaningless for the kinds of data we're caching.
Parameters
$cid The cache ID to save the data with.
$data The data to store.
$expire One of the following values:
- CACHE_PERMANENT: Indicates that the item should never be removed except by explicitly using _update_cache_clear() or update_invalidate_cache().
- A Unix timestamp: Indicates that the item should be kept at least until the given time, after which it will be invalidated.
Related topics
Code
modules/update/update.module, line 546
<?php
function _update_cache_set($cid, $data, $expire) {
$serialized = 0;
if (is_object($data) || is_array($data)) {
$data = serialize($data);
$serialized = 1;
}
$created = time();
db_query("UPDATE {cache_update} SET data = %b, created = %d, expire = %d, serialized = %d WHERE cid = '%s'", $data, $created, $expire, $serialized, $cid);
if (!db_affected_rows()) {
@db_query("INSERT INTO {cache_update} (cid, data, created, expire, serialized) VALUES ('%s', %b, %d, %d, %d)", $cid, $data, $created, $expire, $serialized);
}
}
?>Login or register to post comments 