本文整理汇总了PHP中xcache_inc函数的典型用法代码示例。如果您正苦于以下问题:PHP xcache_inc函数的具体用法?PHP xcache_inc怎么用?PHP xcache_inc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xcache_inc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store($key, $value)
{
if (xcache_set($key, $value)) {
xcache_inc('__known_xcache_size', strlen($value));
}
return false;
}
示例2: incrementValue
/**
* {@inheritdoc}
*/
protected function incrementValue($key, $value)
{
if (is_int($inc = xcache_inc($key, (int) $value))) {
return $inc;
}
return false;
}
示例3: 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;
}
示例4: 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;
}
示例5: increment
/**
* Increment the value of an item in the cache.
*
* @param string $key
* @param mixed $value
* @return void
*/
public function increment($key, $value = 1)
{
return xcache_inc($this->prefix . $key, $value);
}
示例6: increment
/**
*
* Increments a cache entry value by the specified amount. If the entry
* does not exist, creates it at zero, then increments it.
*
* @param string $key The entry ID.
*
* @param string $amt The amount to increment by (default +1). Using
* negative values is effectively a decrement.
*
* @return int The new value of the cache entry.
*
*/
public function increment($key, $amt = 1)
{
if (!$this->_active) {
return;
}
// modify the key to add the prefix
$key = $this->entry($key);
// make sure we have a key to increment
$this->add($key, 0, null, $this->_life);
// let xcache do the increment and retain its value
$val = xcache_inc($key, $amt, $this->_life);
// done
return $val;
}
示例7: inc
/**
* @see Temporary_cache_driver::inc()
*/
public function inc($id, $realm = COT_DEFAULT_REALM, $value = 1)
{
return xcache_inc($realm . '/' . $id, $value);
}
示例8: internalIncrementItem
/**
* Internal method to increment an item.
*
* @param string $normalizedKey
* @param int $value
* @return int|bool The new value on success, false on failure
* @throws Exception\ExceptionInterface
*/
protected function internalIncrementItem(&$normalizedKey, &$value)
{
$options = $this->getOptions();
$namespace = $options->getNamespace();
$prefix = $namespace === '' ? '' : $namespace . $options->getNamespaceSeparator();
$internalKey = $prefix . $normalizedKey;
$ttl = $options->getTtl();
$value = (int) $value;
return xcache_inc($internalKey, $value, $ttl);
}
示例9: incr
public function incr($key, $value = 1)
{
return xcache_inc($key, $value);
}
示例10: increment
function increment($key, $by = 1)
{
$formatted = \Cachet\Helper::formatKey([$this->prefix, 'counter', $key]);
$value = xcache_inc($formatted, $by, $this->counterTTL);
return $value;
}
示例11: inc
/**
* Increase a stored number
*
* @param string $key
* @param int $step
* @return int | bool
*/
public function inc($key, $step = 1)
{
return xcache_inc($this->getPrefix() . $key, $step);
}
示例12: _flush_pool
/**
* @param string $key
* @return array|int
*/
private function _flush_pool($key = null)
{
if (!$this->_get_counter_status()) {
return [];
}
if (empty($this->_pool)) {
return [];
}
if ($key === null) {
$result = [];
foreach ($this->_pool as $_key => $_val) {
$result[$_key] = xcache_inc($_key, $_val);
}
$this->_pool = [];
return $result;
}
$_count = 0;
$key = $this->_hash_key($key);
if (isset($this->_pool[$key])) {
$_count = $this->_pool[$key];
xcache_inc($key, $_count);
unset($this->_pool[$key]);
}
return $_count;
}
示例13: inc
/**
* {@inheritdoc}
*/
public function inc($name, $delta = 1)
{
return xcache_inc($this->prefix . $name, $delta);
}
示例14: increment
/**
* Emulates `Memcache::increment`.
*/
public function increment($key, $value = 1)
{
return xcache_inc(self::$key_prefix . $key, $value);
}
示例15: increment
/**
* Increment the value of an item in the cache.
*
* @param string $key
* @param mixed $value
* @return int
*/
public function increment($key, $value = 1)
{
return xcache_inc($this->getPrefixWithLocale() . $key, $value);
}