public function decrement($k, $step = 1) { if ($this->core) { return $this->core->decrement($k, $step); } return apc_dec($k, $step); }
public function dec($key, $step = 1, $success = TRUE) { if (_cacheStatus) { apc_dec($key, $step, $success); } return FALSE; }
public function dec($key, $step = 1, $success = true) { if (CACHE_STATUS) { apc_dec($key, $step, $success); } return false; }
public function dec($key, $expire = 0) { $key = $this->buildKey($key); if (apc_dec($key) === false) { return apc_store($key, 0, $expire); } return true; }
public function dec($key, $step = 1) { $this->type = $type; if (apc_dec($this->_key($key), $step) !== FALSE) { return apc_fetch($this->_key($key)); } return FALSE; }
/** * {@inheritdoc} */ public function decrement($key, $amount = 1) { $result = apc_dec($this->getKey($key), $amount); if ($result < 0) { $result = 0; $this->set($key, $result); } return $result; }
/** * 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) { if ($value === null) { $value = 1; } // make sure the variable exists apc_add($key, 0); return apc_dec($key, $value); }
public function testAPC() { $key = 'APCPolyfillTest'; apc_store($key, 1); apc_inc($key, 2); apc_dec($key); $this->assertEquals(apc_fetch($key, $success), 2); $this->assertTrue($success); apc_delete($key); apc_fetch($key, $success); $this->assertFalse($success); }
/** * Internal method to decrement an item. * * @param string $normalizedKey * @param int $value * @return int|boolean The new value on success, false on failure * @throws Exception\ExceptionInterface */ protected function internalDecrementItem(&$normalizedKey, &$value) { $options = $this->getOptions(); $prefix = $options->getNamespace() . $options->getNamespaceSeparator(); $internalKey = $prefix . $normalizedKey; $value = (int) $value; $newValue = apc_dec($internalKey, $value); // initial value if ($newValue === false) { $ttl = $options->getTtl(); $newValue = -$value; if (!apc_add($internalKey, $newValue, $ttl)) { throw new Exception\RuntimeException("apc_add('{$internalKey}', {$newValue}, {$ttl}) failed"); } } return $newValue; }
public function dec($key, $step = 1) { $this->type = $type; return apc_dec($this->_key($key), $step) !== false ? apc_fetch($this->_key($key)) : false; }
/** * @inheritdoc */ public function decrement($key, $offset = 1, $expire = 0, $create = true) { $hash = $this->prepareKey($key); if ($this->exists($key) === false) { if ($create === false) { return false; } apc_add($hash, 0, $expire); } return apc_dec($hash, $offset); }
public function dec($key, $interval = 1) { return apc_dec($this->_p($key), $interval); }
/** * Decrements the value of an integer cached key * * @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 apc_dec($key, $offset); }
/** * {@inheritdoc} */ public function decrement($counter, $number = 1) { $counter = $this->transform($counter); $value = apc_dec($this->prefix . '/' . $counter->getName(), $number); return $this->handleDecrement($value, $counter, $number); }
/** * Performs an atomic decrement operation on specified numeric cache item. * * Note that, as per the APC specification: * If the item's value is not numeric, the decrement operation has no effect * on the key - it retains it's original non-integer value. * * @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) { return apc_dec($params['key'], $offset); }; }
public function decrement($key, $value = 1) { $key = $this->prefix . $key; return $this->apcu ? apcu_dec($key, $value) : apc_dec($key, $value); }
/** * Enter description here... * * @param string $p_sKey The Key * @param numeric $p_iDec The decremental value * @return numeric */ function decrement($p_sKey, $p_iDec = 1) { return apc_dec($p_sKey, $p_iDec); }
public function decrement($key, $step) { return apc_dec($key, $step); }
/** * Decrements the value of an integer cached key * * @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 apc_dec($key, $offset); }
/** * Decrements a given value by the step value supplied * * Useful for shared counters and other persistent integer based * tracking. * * @param string $id ID of cache entry to decrement * @param integer $step Step value to decrement by [Optional] * * @return integer|boolean * * @uses System::sanitize_id */ public function decrement($id, $step = 1) { return apc_dec(System::sanitize_id($this->config('prefix') . $id), $step); }
function apcu_dec($key, $step = 1, &$success = false) { return apc_dec($key, $step, $success); }
/** * 自减 * * @param mixed $key 要自减的缓存的数据的key * @param int $val 自减的进步值,默认为1 * * @return bool */ public function decrement($key, $val = 1) { return apc_dec($this->conf['prefix'] . $key, abs(intval($val))); }
/** * Decrease a stored number * * @param string $key * @param int $step * @return int | bool */ public function dec($key, $step = 1) { return apc_dec($this->getPrefix() . $key, $step); }
/** * Decrement the value of an item in the cache. * * @param string $key * @param mixed $value * @return int|bool */ public function decrement($key, $value) { return $this->apcu ? apcu_dec($key, $value) : apc_dec($key, $value); }
public function decr($key, $value = 1) { return apc_dec($key . self::KEY_SUFFIX, $value); }
public function decr($key, $value = 1) { return apc_dec($key, $value); }
/** * Decrease 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 decr($key, $amount) { $result = apc_dec($key, $amount); if ($result === false) { apc_store($key, 0 - $amount); $result = 0 - $amount; } return $result; }
public function decrement($key, $value) { return $this->isApcUEnabled ? apcu_dec($key, $value) : apc_dec($key, $value); }
/** * 递减 * 与原始decrement方法区别的是若不存指定KEY时返回false,这个会自动递减 * * @param string $key * @param int $offset * @param int $lifetime 当递减失则时当作set使用 */ public function decrement($key, $offset = 1, $lifetime = 60) { if (\apc_dec($key, $offset)) { return true; } elseif (false == \apc_exists($key) && $this->set($key, $offset, $lifetime)) { return true; } else { return false; } }
public static function decrease($key, $step = 1) { return apc_dec(static::localizeKey($key), $step); }