本文整理汇总了PHP中Memcache::append方法的典型用法代码示例。如果您正苦于以下问题:PHP Memcache::append方法的具体用法?PHP Memcache::append怎么用?PHP Memcache::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Memcache
的用法示例。
在下文中一共展示了Memcache::append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: append
public function append($key, $data)
{
try {
return $this->instance->append($key, $data);
} catch (BaseException $e) {
return $this->alive = false;
}
}
示例2: write
/**
* Write data for key into cache. When using memcache as your cache engine
* remember that the Memcache pecl extension does not support cache expiry times greater
* than 30 days in the future. Any duration greater than 30 days will be treated as never expiring.
*
* @param string $key Identifier for the data
* @param mixed $value Data to be cached
* @param int $duration How long to cache the data, in seconds
* @return bool True if the data was successfully cached, false on failure
* @see http://php.net/manual/en/memcache.set.php
*/
public function write($key, $value, $duration)
{
if ($duration > 30 * DAY) {
$duration = 0;
}
$this->_Memcached->append($this->_keys, str_replace($this->settings['prefix'], '', $this->_keySeparator . $key));
return $this->_Memcached->set($key, $value, $duration);
}