當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wincache_ucache_dec函數代碼示例

本文整理匯總了PHP中wincache_ucache_dec函數的典型用法代碼示例。如果您正苦於以下問題:PHP wincache_ucache_dec函數的具體用法?PHP wincache_ucache_dec怎麽用?PHP wincache_ucache_dec使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了wincache_ucache_dec函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: internalDecrementItem

 /**
  * Internal method to decrement an item.
  *
  * @param  string $normalizedKey
  * @param  int    $value
  * @return int|bool The new value on success, false on failure
  * @throws Exception\ExceptionInterface
  */
 protected function internalDecrementItem(&$normalizedKey, &$value)
 {
     $options = $this->getOptions();
     $namespace = $options->getNamespace();
     $prefix = $namespace === '' ? '' : $namespace . $options->getNamespaceSeparator();
     $internalKey = $prefix . $normalizedKey;
     return wincache_ucache_dec($internalKey, (int) $value);
 }
開發者ID:CHRISTOPHERVANDOMME,項目名稱:zf2complet,代碼行數:16,代碼來源:WinCache.php

示例2: dec

 /**
  * Decreases a value from the shared memory storage.
  * 
  * Decreases a value from the shared memory storage. Unlike a plain
  * set($key, get($key)-$step) combination, this function also implicitly
  * performs locking.
  * 
  * @param string $key  Name of key to decrease.
  * @param int    $step Value to decrease the key by.
  * 
  * @return int The new value.
  */
 public function dec($key, $step = 1)
 {
     $newValue = wincache_ucache_dec($this->persistentId . $key, (int) $step, $success);
     if (!$success) {
         throw new SHM\InvalidArgumentException('Unable to decrease the value. Are you sure the value is int?', 302);
     }
     return $newValue;
 }
開發者ID:CBEPX,項目名稱:yii2-mikrotik,代碼行數:20,代碼來源:Wincache.php

示例3: internalDecrementItem

 /**
  * Internal method to decrement an item.
  *
  * Options:
  *  - ttl <float>
  *    - The time-to-life
  *  - namespace <string>
  *    - The namespace to use
  *  - ignore_missing_items <boolean>
  *    - Throw exception on missing item
  *
  * @param  string $normalizedKey
  * @param  int    $value
  * @param  array  $normalizedOptions
  * @return int|boolean The new value or false on failure
  * @throws Exception
  */
 protected function internalDecrementItem(&$normalizedKey, &$value, array &$normalizedOptions)
 {
     $internalKey = $normalizedOptions['namespace'] . $this->getOptions()->getNamespaceSeparator() . $normalizedKey;
     $value = (int) $value;
     $newValue = wincache_ucache_dec($internalKey, $value);
     if ($newValue === false) {
         if (wincache_ucache_exists($internalKey)) {
             throw new Exception\RuntimeException("wincache_ucache_inc('{$internalKey}', {$value}) failed");
         } elseif (!$normalizedOptions['ignore_missing_items']) {
             throw new Exception\ItemNotFoundException("Key '{$internalKey}' not found");
         }
         $newValue = -$value;
         $this->addItem($normalizedKey, $newValue, $normalizedOptions);
     }
     return $newValue;
 }
開發者ID:bradley-holt,項目名稱:zf2,代碼行數:33,代碼來源:WinCache.php

示例4: decrement

 /**
  * Increment the value of an item in the cache.
  *
  * @param  string  $key
  * @param  mixed   $value
  * @return int|bool
  */
 public function decrement($key, $value = 1)
 {
     return wincache_ucache_dec($this->getPrefixWithLocale() . $key, $value);
 }
開發者ID:jooorooo,項目名稱:cache,代碼行數:11,代碼來源:WinCacheStore.php

示例5: decrement

 /**
  * Decrement a raw value
  *
  * @param	string	$id	Cache ID
  * @param	int	$offset	Step/value to reduce by
  * @return	mixed	New value on success or FALSE on failure
  */
 public function decrement($id, $offset = 1)
 {
     $success = FALSE;
     $value = wincache_ucache_dec($id, $offset, $success);
     return $success === TRUE ? $value : FALSE;
 }
開發者ID:alyayazilim,項目名稱:E-Ticaret-2015,代碼行數:13,代碼來源:Cache_wincache.php

示例6: internalDecrementItem

 /**
  * Internal method to decrement an item.
  *
  * Options:
  *  - ttl <float>
  *    - The time-to-life
  *  - namespace <string>
  *    - The namespace to use
  *
  * @param  string $normalizedKey
  * @param  int    $value
  * @param  array  $normalizedOptions
  * @return int|boolean The new value on success, false on failure
  * @throws Exception\ExceptionInterface
  */
 protected function internalDecrementItem(& $normalizedKey, & $value, array & $normalizedOptions)
 {
     $internalKey = $normalizedOptions['namespace'] . $this->getOptions()->getNamespaceSeparator() . $normalizedKey;
     return wincache_ucache_dec($internalKey, (int)$value);
 }
開發者ID:necrogami,項目名稱:zf2,代碼行數:20,代碼來源:WinCache.php

示例7: decrementItem

 /**
  * Decrement an item.
  *
  * Options:
  *  - namespace <string> optional
  *    - The namespace to use (Default: namespace of object)
  *  - ignore_missing_items <boolean> optional
  *    - Throw exception on missing item or return false
  *
  * @param  string $key
  * @param  int $value
  * @param  array $options
  * @return int|boolean The new value or false or failure
  * @throws Exception
  *
  * @triggers decrementItem.pre(PreEvent)
  * @triggers decrementItem.post(PostEvent)
  * @triggers decrementItem.exception(ExceptionEvent)
  */
 public function decrementItem($key, $value, array $options = array())
 {
     $baseOptions = $this->getOptions();
     if (!$baseOptions->getWritable()) {
         return false;
     }
     $this->normalizeOptions($options);
     $this->normalizeKey($key);
     $args = new ArrayObject(array('key' => &$key, 'options' => &$options));
     try {
         $eventRs = $this->triggerPre(__FUNCTION__, $args);
         if ($eventRs->stopped()) {
             return $eventRs->last();
         }
         $internalKey = $options['namespace'] . $baseOptions->getNamespaceSeparator() . $key;
         $value = (int) $value;
         $newValue = wincache_ucache_dec($internalKey, $value);
         if ($newValue === false) {
             if (wincache_ucache_exists($internalKey)) {
                 throw new Exception\RuntimeException("wincache_ucache_dec('{$internalKey}', {$value}) failed");
             } elseif (!$options['ignore_missing_items']) {
                 throw new Exception\ItemNotFoundException("Key '{$internalKey}' not found");
             }
             $this->addItem($key, -$value, $options);
             $newValue = -$value;
         }
         return $this->triggerPost(__FUNCTION__, $args, $newValue);
     } catch (\Exception $e) {
         return $this->triggerException(__FUNCTION__, $args, $e);
     }
 }
開發者ID:navtis,項目名稱:xerxes-pazpar2,代碼行數:50,代碼來源:WinCache.php

示例8: decrement

 /**
  * 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 wincache_ucache_dec($key, $offset);
 }
開發者ID:CakeDC,項目名稱:cakephp,代碼行數:12,代碼來源:WincacheEngine.php

示例9: dec

 /**
  * 自減緩存(針對數值緩存)
  * @access public
  * @param string    $name 緩存變量名
  * @param int       $step 步長
  * @return false|int
  */
 public function dec($name, $step = 1)
 {
     $key = $this->getCacheKey($name);
     return wincache_ucache_dec($key, $step);
 }
開發者ID:top-think,項目名稱:framework,代碼行數:12,代碼來源:Wincache.php

示例10: decrement

 public function decrement($key, $decrement)
 {
     $success = false;
     $value = wincache_ucache_dec($key, $decrement, $success);
     return $success === true ? $value : false;
 }
開發者ID:znframework,項目名稱:znframework,代碼行數:6,代碼來源:Wincache.php

示例11: decrement

 public function decrement($key, $decrement = 1)
 {
     $success = false;
     if (function_exists('wincache_ucache_dec')) {
         $value = wincache_ucache_dec($key, $decrement, $success);
     } else {
         return getMessage('Cache', 'unsupported', 'Wincache');
     }
     return $success === true ? $value : false;
 }
開發者ID:Allopa,項目名稱:ZN-Framework-Starter,代碼行數:10,代碼來源:WincacheDriver.php

示例12: decrement

 /**
  * 遞減
  *
  * 與原始decrement方法區別的是若不存指定KEY時返回false,這個會自動遞減
  *
  * @param string $key
  * @param int $offset
  * @param int $lifetime 當遞減失則時當作set使用
  * @return boolean
  */
 public function decrement($key, $offset = 1, $lifetime = 60)
 {
     if (wincache_ucache_dec($this->prefix . $key, $offset)) {
         return true;
     } elseif (false == wincache_ucache_exists($this->prefix . $key) && $this->set($key, $offset, $lifetime)) {
         return true;
     } else {
         return false;
     }
 }
開發者ID:liuyu121,項目名稱:myqee,代碼行數:20,代碼來源:wincache.class.php

示例13: decr

 /**
  * 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 = wincache_ucache_dec($key, $amount);
     if ($result === false) {
         wincache_ucache_set($key, 0 - $amount);
         $result = 0 - $amount;
     }
     return $result;
 }
開發者ID:rhymix,項目名稱:rhymix,代碼行數:19,代碼來源:wincache.php

示例14: decr

 function decr($id, $n, $group)
 {
     $key = $this->key($id, $group);
     return wincache_ucache_dec($id, $n);
 }
開發者ID:IDOAgency,項目名稱:PAHClinic,代碼行數:5,代碼來源:wincache.object-cache.php

示例15: dec

 public function dec($key, $step = 1)
 {
     return wincache_ucache_dec($key, $step);
 }
開發者ID:tang86,項目名稱:discuz-utf8,代碼行數:4,代碼來源:memory_driver_wincache.php


注:本文中的wincache_ucache_dec函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。