本文整理汇总了PHP中zend_disk_cache_store函数的典型用法代码示例。如果您正苦于以下问题:PHP zend_disk_cache_store函数的具体用法?PHP zend_disk_cache_store怎么用?PHP zend_disk_cache_store使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zend_disk_cache_store函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zdcStore
/**
* Store data into Zend Data Disk Cache
*
* @param string $internalKey
* @param mixed $value
* @param int $ttl
* @return void
* @throws Exception\RuntimeException
*/
protected function zdcStore($internalKey, $value, $ttl)
{
if (!zend_disk_cache_store($internalKey, $value, $ttl)) {
$valueType = gettype($value);
throw new Exception\RuntimeException("zend_disk_cache_store({$internalKey}, <{$valueType}>, {$ttl}) failed");
}
}
示例2: _store
/**
* Store data
*
* @param mixed $data Object to store
* @param string $id Cache id
* @param int $timeToLive Time to live in seconds
* @return boolean true if no problem
*/
protected function _store($data, $id, $timeToLive)
{
if (zend_disk_cache_store($this->_options['namespace'] . '::' . $id, $data, $timeToLive) === false) {
$this->_log('Store operation failed.');
return false;
}
return true;
}
示例3: driverWrite
/**
* @param \Psr\Cache\CacheItemInterface $item
* @return mixed
* @throws \InvalidArgumentException
*/
protected function driverWrite(CacheItemInterface $item)
{
/**
* Check for Cross-Driver type confusion
*/
if ($item instanceof Item) {
$ttl = $item->getExpirationDate()->getTimestamp() - time();
return zend_disk_cache_store($item->getKey(), $this->driverPreWrap($item), $ttl > 0 ? $ttl : 0);
} else {
throw new \InvalidArgumentException('Cross-Driver type confusion detected');
}
}
示例4: add
/**
* Add to the cache
*
* Add a new variable to the cache that you will then be able
* to retrieve using the $this->get($name) method.
*
* @param string $name The name of the cache variable to store.
* @param string $value The value of the cache variable to store.
* @param integer $expire When should it expire? Default: 900 seconds.
*
* @return boolean Depending on the success of the operation,
* either true or false.
*/
public function add($name, $value, $expiry = 900)
{
return zend_disk_cache_store($name, $value, $expiry);
}
示例5: set
public function set($key, $value, $ttl = 0)
{
$safeKey = $this->makeKey($key);
$ret = @zend_disk_cache_store($safeKey, $value, $ttl);
return $ret;
}
示例6: put
/**
* {@inheritdoc}
*/
public function put($key, $data, $ttl = 0)
{
return zend_disk_cache_store($key, $data, $ttl);
}
示例7: _set
protected function _set($key, $data, $ttl)
{
if (zend_disk_cache_store($this->key($key), $data, $ttl) === false) {
throw new \fluxbb\cache\Exception('Unable to write Zend Disk cache: ' . $key);
}
}
示例8: write
/**
* Write datas on $uid key
* @param mixed $uid
* @param mixed $mixed
*/
public function write($uid, $mixed)
{
return zend_disk_cache_store($uid, $mixed);
}