本文整理匯總了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);
}