1 common.inc | tempstore_set($collection, $name, $value, $expire) |
Stores an object in the semi-persistent key-value store.
Parameters
string $collection: A string defining the collection or group indicator. Must be less than 128 characters.
string $name: The name of the object being stored. Must be less than 128 characters.
array|object $value: The data to be stored. This will be serialized prior to writing.
int $expire: The UNIX timestamp at which this value can be deleted.
Related topics
File
- core/
includes/ common.inc, line 1700 - Common functions that many Backdrop modules will need to reference.
Code
function tempstore_set($collection, $name, $value, $expire) {
tempstore_clear($collection, $name);
db_insert('tempstore')
->fields(array(
'collection' => $collection,
'name' => $name,
'value' => serialize($value),
'expire' => $expire,
))
->execute();
}