本文整理汇总了PHP中wincache_ucache_add函数的典型用法代码示例。如果您正苦于以下问题:PHP wincache_ucache_add函数的具体用法?PHP wincache_ucache_add怎么用?PHP wincache_ucache_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wincache_ucache_add函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
/**
* @param string $key
* @param mixed $value
* @param integer $ttl
* @return mixed
*/
public function set($key, $value, $ttl = null)
{
if (!$this->exists($key)) {
return wincache_ucache_add($keyword, $value, null === $ttl ? 0 : $ttl);
}
return wincache_ucache_set($keyword, $value, null === $ttl ? 0 : $ttl);
}
示例2: add
/**
* Adds a new item that is to be cached
*
* @param string $key
* @param mixed $data
* @param bool $overwrite
* @return bool
*/
public function add($key, $data, $overwrite = false)
{
if ($overwrite == false) {
return wincache_ucache_add($key, $data, $this->ttl());
} else {
return wincache_ucache_set($key, $data, $this->ttl());
}
}
示例3: add
public function add($key, $var, $expire= 0, $options= array()) {
$added= wincache_ucache_add(
$this->getCacheKey($key),
$var,
$expire
);
return $added;
}
示例4: driver_set
function driver_set($keyword, $value = "", $time = 300, $option = array())
{
if (isset($option['skipExisting']) && $option['skipExisting'] == true) {
return wincache_ucache_add($keyword, $value, $time);
} else {
return wincache_ucache_set($keyword, $value, $time);
}
}
示例5: store
public function store($key, $value, $overwrite, $ttl = 0)
{
if ($overwrite) {
return wincache_ucache_set($key, $value, $ttl);
} else {
// emits a warning if the key already exists
return @wincache_ucache_add($key, $value, $ttl);
}
}
示例6: _storeData
private function _storeData()
{
$this->_currentObject->detach();
$obj = serialize($this->_currentObject);
if (wincache_ucache_exists($this->_cachePrefix . $this->_currentObjectID . '.cache')) {
wincache_ucache_set($this->_cachePrefix . $this->_currentObjectID . '.cache', $obj, $this->_cacheTime);
} else {
wincache_ucache_add($this->_cachePrefix . $this->_currentObjectID . '.cache', $obj, $this->_cacheTime);
}
$this->_currentObjectID = $this->_currentObject = null;
}
示例7: put
/**
* Write an item to the cache for a given number of minutes.
*
* <code>
* // Put an item in the cache for 15 minutes
* Cache::put('name', 'Robin', 15);
* </code>
*
* @param string $key
* @param mixed $value
* @param int $minutes
*
* @return bool|void
*/
public function put($key, $value, $minutes)
{
return wincache_ucache_add($this->key . $key, $value, $minutes * 60);
}
示例8: addValues
/**
* Adds multiple key-value pairs to cache.
* The default implementation calls [[addValue()]] multiple times add values one by one. If the underlying cache
* storage supports multiadd, this method should be overridden to exploit that feature.
* @param array $data array where key corresponds to cache key while value is the value stored
* @param integer $expire the number of seconds in which the cached values will expire. 0 means never expire.
* @return array array of failed keys
*/
protected function addValues($data, $expire)
{
return wincache_ucache_add($data, null, $expire);
}
示例9: put
/**
* Store an item in the cache for a given number of minutes.
*
* @param string $key
* @param mixed $value
* @param int $minutes
* @return void
*/
public function put($key, $value, $minutes)
{
wincache_ucache_add($this->prefix . $key, $value, $minutes * 60);
}
示例10: addValue
/**
* Stores a value identified by a key into cache if the cache does not contain this key.
* This is the implementation of the method declared in the parent class.
*
* @param string $key the key identifying the value to be cached
* @param string $value the value to be cached
* @param integer $expire the number of seconds in which the cached value will expire. 0 means never expire.
* @return boolean true if the value is successfully stored into cache, false otherwise
*/
protected function addValue($key, $value, $expire)
{
return wincache_ucache_add($key, $value, $expire);
}
示例11: storeItem
/**
* Store an item in the cache for a given number of minutes.
*
* @param string $key
* @param mixed $value
* @param int $minutes
* @return void
*/
protected function storeItem($key, $value, $minutes)
{
wincache_ucache_add($this->prefix . $key, $value, $minutes * 60);
}
示例12: _doSave
/**
* Save a cache record directly. This method is implemented by the cache
* drivers and used in Doctrine_Cache_Driver::save()
*
* @param string $id cache id
* @param string $data data to cache
* @param int $lifeTime if != false, set a specific lifetime for this cache record (null => infinite lifeTime)
* @return boolean true if no problem
*/
protected function _doSave($id, $data, $lifeTime = false)
{
return wincache_ucache_add($id, $data, (int) $lifeTime);
}
示例13: 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 wincache_ucache_add($name, $value, $expiry);
}
示例14: add
/**
* 缓存一个变量到数据存储
*
* @access public
*
* @param string $key 数据key
* @param mixed $value 数据值
* @param int $expire 缓存时间(秒)
*
* @return boolean
*/
public function add($key, $value, $expire = null)
{
//参数分析
if (!$key) {
return false;
}
$expire = is_null($expire) ? $this->_defaultOptions['expire'] : $expire;
return wincache_ucache_add($key, $value, $expire);
}
示例15: addItems
/**
* Add multiple items.
*
* Options:
* - namespace <string> optional
* - The namespace to use (Default: namespace of object)
* - tags <array> optional
* - An array of tags
*
* @param array $keyValuePairs
* @param array $options
* @return boolean
* @throws Exception
*
* @triggers addItems.pre(PreEvent)
* @triggers addItems.post(PostEvent)
* @triggers addItems.exception(ExceptionEvent)
*/
public function addItems(array $keyValuePairs, array $options = array())
{
$baseOptions = $this->getOptions();
if (!$baseOptions->getWritable()) {
return false;
}
$this->normalizeOptions($options);
$args = new ArrayObject(array('keyValuePairs' => &$keyValuePairs, 'options' => &$options));
try {
$eventRs = $this->triggerPre(__FUNCTION__, $args);
if ($eventRs->stopped()) {
return $eventRs->last();
}
$internalKeyValuePairs = array();
$prefix = $options['namespace'] . $baseOptions->getNamespaceSeparator();
foreach ($keyValuePairs as $key => &$value) {
$internalKey = $prefix . $key;
$internalKeyValuePairs[$internalKey] =& $value;
}
$errKeys = wincache_ucache_add($internalKeyValuePairs, null, $options['ttl']);
if ($errKeys !== array()) {
throw new Exception\RuntimeException("wincache_ucache_add(<array>, null, {$options['ttl']}) failed for keys: " . "'" . implode("','", array_keys($errKeys)) . "'");
}
$result = true;
return $this->triggerPost(__FUNCTION__, $args, $result);
} catch (\Exception $e) {
return $this->triggerException(__FUNCTION__, $args, $e);
}
}