method set documentation in bbn\Cache
Stores the given value in the cache for as long as says the TTL.
function($item, $val, $ttl = NULL, float $exec = NULL)
{
if (self::$type) {
$ttl = self::ttl($ttl);
$hash = self::makeHash($val);
switch (self::$type){
case 'apc':
return \apc_store(
$item, [
'timestamp' => microtime(1),
'hash' => $hash,
'ttl' => $ttl,
'value' => $val
], $ttl
);
case 'memcache':
return $this->obj->set(
$item, [
'timestamp' => microtime(1),
'hash' => $hash,
'ttl' => $ttl,
'value' => $val
], false, $ttl
);
case 'files':
$file = self::_file($item, $this->path);
if ($this->fs->createPath(X::dirname($file))) {
$value = [
'timestamp' => microtime(1),
'hash' => $hash,
'expire' => $ttl ? time() + $ttl : 0,
'ttl' => $ttl,
'exec' => $exec,
'value' => $val
];
if ($this->fs->putContents($file, json_encode($value, JSON_PRETTY_PRINT))) {
return true;
}
}
}
}
return false;
}
Stores the given value in the cache for as long as says the TTL. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions