本文整理汇总了PHP中xcache_dec函数的典型用法代码示例。如果您正苦于以下问题:PHP xcache_dec函数的具体用法?PHP xcache_dec怎么用?PHP xcache_dec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xcache_dec函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public function add($key, $value = 1, $ttl = 600)
{
$result = 0;
if (is_numeric($value)) {
$result = $value > 0 ? xcache_inc($key, $value, $ttl) : xcache_dec($key, abs($value), $ttl);
}
return $result;
}
示例2: modifyInteger
public function modifyInteger($key, $offset, &$success = null)
{
$success = false;
if ($offset > 0) {
$newValue = xcache_inc($key, $offset);
} else {
$newValue = xcache_dec($key, abs($offset));
}
if (is_int($newValue)) {
$success = true;
}
return $newValue;
}
示例3: decrement
/**
* Decrements the value of an integer cached key.
* If the cache key is not an integer it will be treated as 0
*
* @param string $key Identifier for the data
* @param int $offset How much to subtract
* @return New decremented value, false otherwise
*/
public function decrement($key, $offset = 1)
{
return xcache_dec($key, $offset);
}
示例4: decrement
/**
* Decrements the value of an integer cached key.
* If the cache key is not an integer it will be treated as 0
*
* @param string $key Identifier for the data
* @param int $offset How much to subtract
* @return bool|int New decremented value, false otherwise
*/
public function decrement($key, $offset = 1)
{
$key = $this->_key($key);
return xcache_dec($key, $offset);
}
示例5: decrement
/**
* Performs an atomic decrement operation on specified numeric cache item.
*
* Note that, as per the XCache specification:
* If the item's value is not numeric, it is treated as if the value were 0.
* It is possible to decrement a value into the negative integers.
*
* @param string $key Key of numeric cache item to decrement.
* @param integer $offset Offset to decrement - defaults to `1`.
* @return integer|boolean The item's new value on successful decrement, else `false`.
*/
public function decrement($key, $offset = 1)
{
return xcache_dec($this->_config['scope'] ? "{$this->_config['scope']}:{$key}" : $key, $offset);
}
示例6: decrement
/**
* Performs an atomic decrement operation on specified numeric cache item.
*
* Note that, as per the XCache specification:
* If the item's value is not numeric, it is treated as if the value were 0.
* It is possible to decrement a value into the negative integers.
*
* @param string $key Key of numeric cache item to decrement
* @param integer $offset Offset to decrement - defaults to 1.
* @return mixed Item's new value on successful decrement, false otherwise
*/
public function decrement($key, $offset = 1)
{
return function ($self, $params, $chain) use($offset) {
extract($params);
return xcache_dec($key, $offset);
};
}
示例7: dec
public function dec($key, $step = 1)
{
$this->type = $type;
return xcache_dec($this->_key($key), $step);
}
示例8: decrement
/**
* {@inheritdoc}
*/
public function decrement($name, $delta = 1)
{
return xcache_dec($this->options['prefix'] . $name, $delta);
}
示例9: dec
/**
* @see Temporary_cache_driver::dec()
*/
public function dec($id, $realm = COT_DEFAULT_REALM, $value = 1)
{
return xcache_dec($realm . '/' . $id, $value);
}
示例10: decrement
public function decrement($key, $step = 1)
{
return \xcache_dec($key, $step);
}
示例11: decrease
/**
* Decreases the value in the variable store
* @param string $key The key of the variable
* @param integer $value The value to decrease with
* @param integer $timeToLive Set to a number of seconds to make the variable expire in that amount of time
* @return mixed The new value of the variable
*/
public function decrease($key, $value = null, $timeToLive = null)
{
return xcache_dec($key, $value, $timeToLive);
}
示例12: intdec
static function intdec($key, $value, $ttl)
{
return xcache_dec($key, $value, $ttl);
}
示例13: decr
public function decr($id, $val = 1, $group = Cache::DEFAULT_GROUP, $ttl = Cache::DEFAULT_TTL)
{
return xcache_dec($this->getPrefix($group) . $id, $val, $ttl);
}
示例14: dec
/**
* Decrements numeric cache item's value.
*
* {@inheritDoc}
*
* @see \app\src\Cache\etsis_Abstract_Cache::dec()
*
* @since 6.2.0
* @param int|string $key
* The cache key to decrement.
* @param int $offset
* Optional. The amount by which to decrement the item's value. Default: 1.
* @param string $namespace
* Optional. The namespace the key is in. Default: 'default'.
* @return false|int False on failure, the item's new value on success.
*/
public function dec($key, $offset = 1, $namespace = 'default')
{
$unique_key = $this->uniqueKey($key, $namespace);
return xcache_dec($unique_key, (int) $offset);
}
示例15: decr
public function decr($id, $value = 1, $ttl = Cache::DEFAULT_TTL)
{
return xcache_dec($this->prefix . $id, $value, $ttl);
}