public function store($key, $value) { if (xcache_set($key, $value)) { xcache_inc('__known_xcache_size', strlen($value)); } return false; }
/** * {@inheritdoc} */ protected function incrementValue($key, $value) { if (is_int($inc = xcache_inc($key, (int) $value))) { return $inc; } return false; }
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; }
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; }
/** * 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); }
/** * * 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; }
/** * @see Temporary_cache_driver::inc() */ public function inc($id, $realm = COT_DEFAULT_REALM, $value = 1) { return xcache_inc($realm . '/' . $id, $value); }
/** * 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); }
public function incr($key, $value = 1) { return xcache_inc($key, $value); }
function increment($key, $by = 1) { $formatted = \Cachet\Helper::formatKey([$this->prefix, 'counter', $key]); $value = xcache_inc($formatted, $by, $this->counterTTL); return $value; }
/** * 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); }
/** * @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; }
/** * {@inheritdoc} */ public function inc($name, $delta = 1) { return xcache_inc($this->prefix . $name, $delta); }
/** * Emulates `Memcache::increment`. */ public function increment($key, $value = 1) { return xcache_inc(self::$key_prefix . $key, $value); }
/** * 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); }
/** * Increase the value of a key by $amount. * * If the key does not exist, this method assumes that the current value is zero. * This method returns the new value. * * @param string $key * @param int $amount * @return int */ public function incr($key, $amount) { return xcache_inc($key, $amount); }
/** * Increments 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 integer $offset How much to increment * @return New incremented value, false otherwise */ public function increment($key, $offset = 1) { return xcache_inc($key, $offset); }
{ // Revision 621 $cnt = xcache_count(XC_TYPE_VAR); for ($i = 0; $i < $cnt; $i++) { xcache_clear_cache(XC_TYPE_VAR, $i); } return true; } private static function xcache_delete($name) { $name = self::getMemoryName($name); return xcache_unset($name);
public function inc($key, $step = 1) { $this->type = $type; return xcache_inc($this->_key($key), $step); }
/** * Increases the value in the variable store * @param string $key The key of the variable * @param integer $value The value to increase 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 increase($key, $value = null, $timeToLive = null) { return xcache_inc($key, $value, $timeToLive); }
/** * Performs an atomic increment 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. * * @param string $key Key of numeric cache item to increment * @param integer $offset Offset to increment - defaults to 1. * @return mixed Item's new value on successful increment, false otherwise */ public function increment($key, $offset = 1) { return function ($self, $params, $chain) use($offset) { extract($params); return xcache_inc($key, $offset); }; }
public function inc($key, $step = 1) { return xcache_inc($key, $step); }
/** * Performs an atomic increment 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. * * @param string $key Key of numeric cache item to increment. * @param integer $offset Offset to increment - defaults to `1`. * @return integer|boolean The item's new value on successful increment, else `false`. */ public function increment($key, $offset = 1) { return xcache_inc($this->_config['scope'] ? "{$this->_config['scope']}:{$key}" : $key, $offset); }
/** * Increments the group value to simulate deletion of all keys under a group * old values will remain in storage until they expire. * * @param string $group The group to clear. * @return bool success */ public function clearGroup($group) { return (bool) xcache_inc($this->settings['prefix'] . $group, 1); }
/** * Increments the group value to simulate deletion of all keys under a group * old values will remain in storage until they expire. * * @param string $group The group to clear. * @return bool success */ public function clearGroup($group) { return (bool) xcache_inc($this->_config['prefix'] . $group, 1); }
public function increment($key, $step = 1) { return \xcache_inc($key, $step); }
/** * Tests that configuring groups for stored keys return the correct values when read/written * Shows that altering the group value is equivalent to deleting all keys under the same * group * * @return void */ public function testGroupsReadWrite() { Cache::config('xcache_groups', array('engine' => 'Xcache', 'duration' => 0, 'groups' => array('group_a', 'group_b'), 'prefix' => 'test_')); $this->assertTrue(Cache::write('test_groups', 'value', 'xcache_groups')); $this->assertEquals('value', Cache::read('test_groups', 'xcache_groups')); xcache_inc('test_group_a', 1); $this->assertFalse(Cache::read('test_groups', 'xcache_groups')); $this->assertTrue(Cache::write('test_groups', 'value2', 'xcache_groups')); $this->assertEquals('value2', Cache::read('test_groups', 'xcache_groups')); xcache_inc('test_group_b', 1); $this->assertFalse(Cache::read('test_groups', 'xcache_groups')); $this->assertTrue(Cache::write('test_groups', 'value3', 'xcache_groups')); $this->assertEquals('value3', Cache::read('test_groups', 'xcache_groups')); }
/** * {@inheritdoc} */ public function increment($name, $delta = 1) { return xcache_inc($this->options['prefix'] . $name, $delta); }
public function inc($key, $interval = 1) { return xcache_inc($this->_p($key), $interval); }
/** * Use key as a counter and add integet value to it */ public function counter_add($key, $value) { if ($value == 0) { return true; } $storage_key = $this->get_item_key($key); $r = xcache_inc($storage_key, $value); if (!$r) { // it doesnt initialize counter by itself $this->counter_set($key, 0); } return $r; }