本文整理汇总了PHP中wincache_ucache_add函数的典型用法代码示例。如果您正苦于以下问题:PHP wincache_ucache_add函数的具体用法?PHP wincache_ucache_add怎么用?PHP wincache_ucache_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wincache_ucache_add函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:mactronique,项目名称:phpcache,代码行数:13,代码来源:WincacheDriver.php
示例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());
}
}
开发者ID:jinshana,项目名称:tangocms,代码行数:16,代码来源:Wincache.php
示例3: add
public function add($key, $var, $expire= 0, $options= array()) {
$added= wincache_ucache_add(
$this->getCacheKey($key),
$var,
$expire
);
return $added;
}
开发者ID:raf3600,项目名称:revolution,代码行数:8,代码来源:xpdowincache.class.php
示例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);
}
}
开发者ID:rylanb,项目名称:Play-Later,代码行数:8,代码来源:wincache.php
示例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);
}
}
开发者ID:kuria,项目名称:cache,代码行数:9,代码来源:WinCacheDriver.php
示例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;
}
开发者ID:kumarsivarajan,项目名称:ctrl-dock,代码行数:11,代码来源:Wincache.php
示例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);
}
开发者ID:PermeAgility,项目名称:FrameworkBenchmarks,代码行数:18,代码来源:Wincache.php
示例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);
}
开发者ID:davidpersson,项目名称:FrameworkBenchmarks,代码行数:12,代码来源:WinCache.php
示例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);
}
开发者ID:Thomvh,项目名称:turbine,代码行数:12,代码来源:WinCacheStore.php
示例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);
}
开发者ID:charlymanja,项目名称:traceper,代码行数:13,代码来源:CWinCache.php
示例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);
}
开发者ID:defra91,项目名称:levecchiecredenze.it,代码行数:12,代码来源:WinCacheStore.php
示例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);
}
开发者ID:juokaz,项目名称:wincache-adapters,代码行数:13,代码来源:WinCache.php
示例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);
}
开发者ID:jeremykendall,项目名称:frapi,代码行数:17,代码来源:Wincache.php
示例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);
}
开发者ID:a53abc,项目名称:doitphp,代码行数:20,代码来源:Cache_Wincache.class.php
示例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);
}
}
开发者ID:navtis,项目名称:xerxes-pazpar2,代码行数:47,代码来源:WinCache.php
示例16: internalAddItems
/**
* Internal method to add multiple items.
*
* Options:
* - ttl <float>
* - The time-to-life
* - namespace <string>
* - The namespace to use
*
* @param array $normalizedKeyValuePairs
* @param array $normalizedOptions
* @return boolean
* @throws Exception
*/
protected function internalAddItems(array &$normalizedKeyValuePairs, array &$normalizedOptions)
{
$internalKeyValuePairs = array();
$prefix = $normalizedOptions['namespace'] . $this->getOptions()->getNamespaceSeparator();
foreach ($normalizedKeyValuePairs as $normalizedKey => $value) {
$internalKey = $prefix . $normalizedKey;
$internalKeyValuePairs[$internalKey] = $value;
}
$errKeys = wincache_ucache_add($internalKeyValuePairs, null, $normalizedOptions['ttl']);
if ($errKeys !== array()) {
throw new Exception\RuntimeException("wincache_ucache_add(<array>, null, {$normalizedOptions['ttl']}) failed for keys: " . "'" . implode("','", array_keys($errKeys)) . "'");
}
return true;
}
开发者ID:bradley-holt,项目名称:zf2,代码行数:28,代码来源:WinCache.php
示例17: internalAddItems
/**
* Internal method to add multiple items.
*
* @param array $normalizedKeyValuePairs
* @return array Array of not stored keys
* @throws Exception\ExceptionInterface
*/
protected function internalAddItems(array &$normalizedKeyValuePairs)
{
$options = $this->getOptions();
$namespace = $options->getNamespace();
if ($namespace === '') {
return wincache_ucache_add($normalizedKeyValuePairs, null, $options->getTtl());
}
$prefix = $namespace . $options->getNamespaceSeparator();
$internalKeyValuePairs = [];
foreach ($normalizedKeyValuePairs as $normalizedKey => $value) {
$internalKey = $prefix . $normalizedKey;
$internalKeyValuePairs[$internalKey] = $value;
}
$result = wincache_ucache_add($internalKeyValuePairs, null, $options->getTtl());
// remove key prefic
$prefixL = strlen($prefix);
foreach ($result as &$key) {
$key = substr($key, $prefixL);
}
return $result;
}
开发者ID:CHRISTOPHERVANDOMME,项目名称:zf2complet,代码行数:28,代码来源:WinCache.php
示例18: add
/**
* Adds data
*
* @param string $key
* @param mixed $var
* @param integer $expire
* @return boolean
*/
function add($key, &$var, $expire = 0)
{
return wincache_ucache_add($key, serialize($var), $expire);
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:12,代码来源:Wincache.php
示例19: add
/**
* Adds a value to the shared memory storage.
*
* Sets a value to the storage if it doesn't exist, or fails if it does.
*
* @param string $key Name of key to associate the value with.
* @param mixed $value Value for the specified key.
* @param int $ttl Seconds to store the value. If set to 0 indicates no
* time limit.
*
* @return bool TRUE on success, FALSE on failure.
*/
public function add($key, $value, $ttl = 0)
{
return wincache_ucache_add($this->persistentId . $key, $value, $ttl);
}
开发者ID:CBEPX,项目名称:yii2-mikrotik,代码行数:16,代码来源:Wincache.php
示例20: internalAddItems
/**
* Internal method to add multiple items.
*
* Options:
* - ttl <float>
* - The time-to-life
* - namespace <string>
* - The namespace to use
*
* @param array $normalizedKeyValuePairs
* @param array $normalizedOptions
* @return array Array of not stored keys
* @throws Exception\ExceptionInterface
*/
protected function internalAddItems(array & $normalizedKeyValuePairs, array & $normalizedOptions)
{
$internalKeyValuePairs = array();
$prefix = $normalizedOptions['namespace'] . $this->getOptions()->getNamespaceSeparator();
foreach ($normalizedKeyValuePairs as $normalizedKey => $value) {
$internalKey = $prefix . $normalizedKey;
$internalKeyValuePairs[$internalKey] = $value;
}
$result = wincache_ucache_add($internalKeyValuePairs, null, $normalizedOptions['ttl']);
// remove key prefic
foreach ($result as & $key) {
$key = substr($key, $prefixL);
}
return $result;
}
开发者ID:necrogami,项目名称:zf2,代码行数:32,代码来源:WinCache.php
注:本文中的wincache_ucache_add函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论