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


PHP apcu_exists函数代码示例

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


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

示例1: fetch

 public function fetch($key)
 {
     if (apcu_exists($key)) {
         return apcu_fetch($key);
     }
     return false;
 }
开发者ID:Athorcis,项目名称:athorrent-frontend,代码行数:7,代码来源:ApcCache.php

示例2: has

 /**
  * {@inheritdoc}
  */
 public function has($key)
 {
     if (!apcu_exists($key)) {
         return false;
     }
     return true;
 }
开发者ID:sugiphp,项目名称:cache,代码行数:10,代码来源:ApcuStore.php

示例3: has

 /**
  * {@inheritdoc}
  */
 public function has($name)
 {
     if ($this->driver == self::APCU_DRIVER) {
         return apcu_exists($this->prefix . $name);
     }
     return apc_exists($this->prefix . $name);
 }
开发者ID:tuneyourserver,项目名称:components,代码行数:10,代码来源:APCStore.php

示例4: fetch

 public function fetch($key, $default = '')
 {
     if (!apcu_exists($this->hash($key))) {
         return $default;
     }
     return apcu_fetch($this->hash($key));
 }
开发者ID:ArtifexTech,项目名称:life-jacket,代码行数:7,代码来源:Apcu.php

示例5: test_purge

 /**
  * Test purging the apcu cache store.
  */
 public function test_purge()
 {
     if (!cachestore_apcu::are_requirements_met()) {
         $this->markTestSkipped('Could not test cachestore_apcu. Requirements are not met.');
     }
     $definition = cache_definition::load_adhoc(cache_store::MODE_APPLICATION, 'cachestore_apcu', 'phpunit_test');
     $instance = cachestore_apcu::initialise_unit_test_instance($definition);
     // Test a simple purge return.
     $this->assertTrue($instance->purge());
     // Test purge works.
     $this->assertTrue($instance->set('test', 'monster'));
     $this->assertSame('monster', $instance->get('test'));
     $this->assertTrue($instance->purge());
     $this->assertFalse($instance->get('test'));
     // Test purge with custom data.
     $this->assertTrue($instance->set('test', 'monster'));
     $this->assertSame('monster', $instance->get('test'));
     $this->assertTrue(apcu_store('test', 'pirate', 180));
     $this->assertSame('monster', $instance->get('test'));
     $this->assertTrue(apcu_exists('test'));
     $this->assertSame('pirate', apcu_fetch('test'));
     // Purge and check that our data is gone but the the custom data is still there.
     $this->assertTrue($instance->purge());
     $this->assertFalse($instance->get('test'));
     $this->assertTrue(apcu_exists('test'));
     $this->assertSame('pirate', apcu_fetch('test'));
 }
开发者ID:linnaea,项目名称:moodle-cachestore_apcu,代码行数:30,代码来源:apcu_test.php

示例6: has

 public function has($key)
 {
     if ($this->apcu) {
         return apcu_exists((string) $key);
     }
     return apc_exists((string) $key);
 }
开发者ID:maslosoft,项目名称:cache,代码行数:7,代码来源:Apc.php

示例7: read

 public function read()
 {
     if (!apcu_exists($this->key)) {
         return array('_global' => array());
     }
     return apcu_fetch($this->key);
 }
开发者ID:ArtifexTech,项目名称:life-jacket,代码行数:7,代码来源:Apcu.php

示例8: cacheHas

 /**
  * @param string $key
  * @return bool
  */
 protected static function cacheHas($key)
 {
     if (self::apcuExists()) {
         return apcu_exists($key);
     }
     return false;
 }
开发者ID:powerlinks,项目名称:php-open-rtb,代码行数:11,代码来源:Cache.php

示例9: increment

 public static function increment($host)
 {
     if (!apcu_exists(self::$prefix . $host)) {
         apcu_store(self::$prefix . $host, 0, self::$ttl);
     }
     apcu_inc(self::$prefix . $host);
     return apcu_fetch(self::$prefix . $host);
 }
开发者ID:ariarijp,项目名称:cassowary,代码行数:8,代码来源:ApcuAdapter.php

示例10: exist

 public function exist($name)
 {
     if ($this->hasAPCu) {
         return apcu_exists($name);
     } else {
         return isset($_SESSION[$name]);
     }
 }
开发者ID:xuedi,项目名称:pedetes,代码行数:8,代码来源:cache.php

示例11: exists

 public static function exists($k)
 {
     if (function_exists('apc_exists')) {
         return apc_exists($k);
     } elseif (function_exists('apcu_exists')) {
         return apcu_exists($k);
     }
     return false;
 }
开发者ID:netroby,项目名称:crossapc,代码行数:9,代码来源:crossapc.php

示例12: getHandlers

 public function getHandlers()
 {
     $key = $this->_mapTags($this->_handlers_name, 0);
     if (apcu_exists($key)) {
         $result = apcu_fetch($key);
         return $result;
     }
     return array();
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:9,代码来源:Apcu.php

示例13: has

 /**
  * {@inheritdoc }
  */
 public function has($key)
 {
     $tKey = $this->getKey($key);
     if (function_exists("\\apcu_exists") || function_exists("\\apc_exists")) {
         return (bool) ($this->apcu ? \apcu_exists($tKey) : \apc_exists($tKey));
     } else {
         $result = false;
         $this->apcu ? \apcu_fetch($tKey, $result) : \apc_fetch($tKey, $result);
         return (bool) $result;
     }
 }
开发者ID:gqfjob,项目名称:codeigniter-webmis,代码行数:14,代码来源:Apc.php

示例14: decr

 public function decr($key, $value = 1)
 {
     /**
      * @todo When we only support php 7 or higher remove this hack
      *
      * https://github.com/krakjoe/apcu/issues/166
      */
     if (apcu_exists($key . self::KEY_SUFFIX)) {
         return apcu_dec($key . self::KEY_SUFFIX, $value);
     } else {
         return apcu_set($key . self::KEY_SUFFIX, -$value);
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:13,代码来源:APCUBagOStuff.php

示例15: test_cross_application_interaction

 /**
  * Test that the Moodle APCu store doesn't cross paths with other code using APCu as well.
  */
 public function test_cross_application_interaction()
 {
     $definition = cache_definition::load_adhoc(cache_store::MODE_APPLICATION, 'cachestore_apcu', 'phpunit_test');
     $instance = cachestore_apcu::initialise_unit_test_instance($definition);
     // Test purge with custom data.
     $this->assertTrue($instance->set('test', 'monster'));
     $this->assertSame('monster', $instance->get('test'));
     $this->assertTrue(apcu_store('test', 'pirate', 180));
     $this->assertSame('monster', $instance->get('test'));
     $this->assertTrue(apcu_exists('test'));
     $this->assertSame('pirate', apcu_fetch('test'));
     // Purge and check that our data is gone but the the custom data is still there.
     $this->assertTrue($instance->purge());
     $this->assertFalse($instance->get('test'));
     $this->assertTrue(apcu_exists('test'));
     $this->assertSame('pirate', apcu_fetch('test'));
 }
开发者ID:janeklb,项目名称:moodle,代码行数:20,代码来源:apcu_test.php


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