当前位置: 首页>>代码示例>>PHP>>正文


PHP apc_inc函数代码示例

本文整理汇总了PHP中apc_inc函数的典型用法代码示例。如果您正苦于以下问题:PHP apc_inc函数的具体用法?PHP apc_inc怎么用?PHP apc_inc使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了apc_inc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: increment

 public function increment($k, $step = 1)
 {
     if ($this->core) {
         return $this->core->increment($k, $step);
     }
     return apc_inc($k, $step);
 }
开发者ID:wukka,项目名称:store,代码行数:7,代码来源:Apc.php

示例2: setup

function setup()
{
    $i = apc_inc('foo', 1);
    var_dump($i);
    $text = "";
    for ($t = 0; $t < $i; $t++) {
        // define a number of classes that should use
        // the same amount of memory as X, so that X will
        // be allocated at a different address on each request
        $text .= "class X{$t} extends Y { function bar() {} }\n";
    }
    $text .= "class Y { const C = {$i}; }\n";
    $file = __FILE__ . ".inc";
    file_put_contents($file, "<?php {$text}");
    include $file;
    unlink($file);
    class X extends Y
    {
        private $priv = 42;
        function foo()
        {
            var_dump($this->priv + self::C);
        }
    }
}
开发者ID:badlamer,项目名称:hhvm,代码行数:25,代码来源:func-guards.php

示例3: incrementBucket

 /**
  * Increments counter value for the given bucket
  *
  * @param string $commandKey
  * @param string $type
  * @param integer $index
  */
 public function incrementBucket($commandKey, $type, $index)
 {
     $bucketName = $this->prefix($commandKey . '_' . $type . '_' . $index);
     if (!apc_add($bucketName, 1, self::BUCKET_EXPIRE_SECONDS)) {
         apc_inc($bucketName);
     }
 }
开发者ID:fhferreira,项目名称:phystrix,代码行数:14,代码来源:ApcStateStorage.php

示例4: updateCounter

 public function updateCounter(array $data)
 {
     $new = apc_add($this->valueKey($data), 0);
     if ($new) {
         apc_store($this->metaKey($data), json_encode($this->metaData($data)));
     }
     apc_inc($this->valueKey($data), $data['value']);
 }
开发者ID:jimdo,项目名称:prometheus_client_php,代码行数:8,代码来源:APC.php

示例5: inc

 public function inc($key, $expire = 0)
 {
     $key = $this->buildKey($key);
     if (apc_inc($key) === false) {
         return apc_store($key, 1, $expire);
     }
     return true;
 }
开发者ID:rickysu,项目名称:tagcache,代码行数:8,代码来源:Apc.php

示例6: get

 /**
  * {@inheritDoc}
  */
 public function get($timestamp)
 {
     $key = sprintf('apc_inc_%d', $timestamp);
     if (apc_add($key, 0, $this->ttl)) {
         return 0;
     }
     return apc_inc($key);
 }
开发者ID:cvasseur,项目名称:sequence-generator,代码行数:11,代码来源:ApcIncrementStorage.php

示例7: increaseSaves

 public function increaseSaves($key)
 {
     $key .= 'inc';
     if (!$this->load($key)) {
         $this->save($key, 0);
     }
     return apc_inc($key, 1);
 }
开发者ID:firstrow,项目名称:feature-science,代码行数:8,代码来源:ApcStorage.php

示例8: inc

 public function inc($key, $step = 1)
 {
     $this->type = $type;
     if (apc_inc($this->_key($key), $step) !== FALSE) {
         return apc_fetch($this->_key($key));
     }
     return FALSE;
 }
开发者ID:my1977,项目名称:shopnc,代码行数:8,代码来源:cache.apc.php

示例9: offsetSet

 /**
  * Assigns a value to the specified offset.
  *
  * @param mixed $offset The offset to assign the value to
  * @param mixed $value  The value to set
  *
  * @return void
  * @see \ArrayAccess::offsetSet()
  * @link http://php.net/manual/en/arrayaccess.offsetset.php
  */
 public function offsetSet($offset, $value)
 {
     // add the data depending an offset has been passed or not
     if (is_null($offset)) {
         $offset = apc_inc($this->serial);
     }
     // store the data back to the property
     $this->__set($offset, $value);
 }
开发者ID:appserver-io,项目名称:synchronizable,代码行数:19,代码来源:ArrayObject.php

示例10: increase

 /**
  * 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)
 {
     if ($value === null) {
         $value = 1;
     }
     // make sure the variable exists
     apc_add($key, 0);
     return apc_inc($key, $value);
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:16,代码来源:ApcIO.php

示例11: del

 /**
  * Delete item from cache
  *
  * @param string	$item	May contain "/" symbols for cache structure, for example users/<i>user_id</i>
  *
  * @return bool
  */
 function del($item)
 {
     if (!$this->apc) {
         return false;
     }
     apc_delete($this->namespaces_imitation($item));
     apc_inc('/' . DOMAIN . "/{$item}");
     unset($this->root_versions_cache['/' . DOMAIN . "/{$item}"]);
     return true;
 }
开发者ID:hypnomez,项目名称:opir.org,代码行数:17,代码来源:APC.php

示例12: _invalidate

 protected function _invalidate($group, $tenant_id)
 {
     $_ggroup = $this->_generation_keyname($group, $tenant_id);
     $generation = apc_inc($_ggroup, 1, $success);
     if (!$success) {
         apc_store($_ggroup, 0);
         $generation = 0;
     }
     return $generation;
 }
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:10,代码来源:APC.php

示例13: increment

 /**
  * @inheritdoc
  */
 public function increment($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_inc($hash, $offset);
 }
开发者ID:romeoz,项目名称:rock-cache,代码行数:14,代码来源:APC.php

示例14: increment

 public function increment($name, $value = 1)
 {
     static $prefix;
     if (!isset($prefix)) {
         $prefix = Kwf_Cache_Simple::getUniquePrefix() . 'bench-';
     }
     apc_inc($prefix . $name, $value, $success);
     if (!$success) {
         apc_add($prefix . $name, $value);
     }
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:11,代码来源:Apc.php

示例15: testAPC

 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);
 }
开发者ID:lavoiesl,项目名称:apc-polyfill,代码行数:12,代码来源:APCPolyfillTest.php


注:本文中的apc_inc函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。