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


PHP Memcached::getResultCode方法代码示例

本文整理汇总了PHP中Memcached::getResultCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Memcached::getResultCode方法的具体用法?PHP Memcached::getResultCode怎么用?PHP Memcached::getResultCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Memcached的用法示例。


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

示例1: has

 /**
  * {@inheritdoc}
  */
 public function has($name)
 {
     if ($this->driver->get($name) === false) {
         return $this->driver->getResultCode() != \Memcached::RES_NOTFOUND;
     }
     return true;
 }
开发者ID:tuneyourserver,项目名称:components,代码行数:10,代码来源:MemcachedDriver.php

示例2: get

 /**
  * Retrieve an item from the cache by key.
  *
  * @param  string  $key
  * @return mixed
  */
 public function get($key)
 {
     $value = $this->memcached->get($this->prefix . $key);
     if ($this->memcached->getResultCode() == 0) {
         return $value;
     }
 }
开发者ID:HarveyCheng,项目名称:myblog,代码行数:13,代码来源:MemcachedStore.php

示例3: exists

 /**
  * {@inheritdoc}
  */
 public function exists()
 {
     if (false === $this->memcached->get($this->storeId)) {
         return MemcachedClient::RES_SUCCESS === $this->memcached->getResultCode();
     }
     return true;
 }
开发者ID:lucidphp,项目名称:mux-cache,代码行数:10,代码来源:Memcached.php

示例4: testInvalidate

 /**
  * @group memcached
  */
 public function testInvalidate()
 {
     $mc = new MemcachedCacheBackend();
     $mc->addServer(new MemcachedServer(self::TEST_MEMCACHE_SERVER));
     $mc->invalidate('test');
     $this->assertFalse($this->memcache->get('test'));
     $this->assertEquals(\Memcached::RES_NOTFOUND, $this->memcache->getResultCode());
 }
开发者ID:hergot,项目名称:databroker,代码行数:11,代码来源:MemcachedCacheBackendTest.php

示例5: get

 /**
  * @param string $key
  * @return mixed|null
  */
 public function get($key)
 {
     $result = $this->memcache->get($key);
     if ($this->memcache->getResultCode() === \Memcached::RES_NOTFOUND) {
         return NULL;
     }
     return $result;
 }
开发者ID:anoxgh,项目名称:simplecache,代码行数:12,代码来源:MemCache.php

示例6: get

 /**
  * Get item
  * @param  string $namespace
  * @param  string $key
  * @return mixed             stored item
  */
 public function get($namespace, $key)
 {
     $store_key = $this->getStoreKey($namespace, $key);
     $value = $this->connect->get($store_key);
     if ($this->connect->getResultCode() == \Memcached::RES_NOTFOUND) {
         return null;
     }
     return $value;
 }
开发者ID:stevleibelt,项目名称:CacheStore,代码行数:15,代码来源:Memcached.php

示例7: get

 public function get($id)
 {
     $flags = null;
     $result = @$this->memcached->get($id);
     if (false === $result && \Memcached::RES_NOTFOUND == $this->memcached->getResultCode()) {
         return null;
     }
     return $result;
 }
开发者ID:layeredcache,项目名称:layeredcache,代码行数:9,代码来源:Memcached.php

示例8: delete

 public function delete($key)
 {
     $this->memcachedObj->delete($key);
     $resultCode = $this->memcachedObj->getResultCode();
     if ($resultCode != \Memcached::RES_SUCCESS && $resultCode != \Memcached::RES_NOTFOUND) {
         throw new StorageException('[STORAGE] "' . $this->getStorageName() . '::delete" failed for key "' . $key . '"!' . ' StorageRespCode: ' . $resultCode);
     }
     unset($this->casArray[$key]);
     return $resultCode;
 }
开发者ID:fustundag,项目名称:tokenbucket,代码行数:10,代码来源:Memcached.php

示例9: retrieve

 /**
  * Responsible for retrieving the authentication token from which persistent storage is in use.
  *
  * @return AccessToken|void
  */
 public function retrieve($hash)
 {
     $cached = $this->memcached->get($this->prefix . $hash);
     if ($this->memcached->getResultCode() === \Memcached::RES_SUCCESS) {
         $json = json_decode($cached, true);
         if (isset($json['token'], $json['expires'])) {
             return new AccessToken($json['token'], DateTime::createFromFormat('U', $json['expires']));
         }
     }
 }
开发者ID:garbetjie,项目名称:wechat,代码行数:15,代码来源:Memcached.php

示例10: isCached

 /**
  * Checks the cache for the presence of a given key.
  * 
  * Memcached does not have a built-in method to check if a key is cached,
  * so internally this method just calls the load() function and checks the
  * result code via Memcached::getResultCode().
  * 
  * @param string $key The key to check.
  * @return boolean TRUE if the requested key is cached, FALSE otherwise.
  */
 public function isCached($key)
 {
     if (isset($this->cache)) {
         $result = $this->load($key);
         if ($this->cache->getResultCode() == Memcached::RES_SUCCESS) {
             return true;
         }
     }
     return false;
 }
开发者ID:Covert-Inferno,项目名称:reaction-toolkit,代码行数:20,代码来源:CacheManager.php

示例11: many

 /**
  * Retrieve multiple items from the cache by key.
  *
  * Items not found in the cache will have a null value.
  *
  * @param  array  $keys
  * @return array
  */
 public function many(array $keys)
 {
     $prefixedKeys = array_map(function ($key) {
         return $this->prefix . $key;
     }, $keys);
     $values = $this->memcached->getMulti($prefixedKeys, null, Memcached::GET_PRESERVE_ORDER);
     if ($this->memcached->getResultCode() != 0) {
         return array_fill_keys($keys, null);
     }
     return array_combine($keys, $values);
 }
开发者ID:quangtruong16994,项目名称:laravel,代码行数:19,代码来源:MemcachedStore.php

示例12: collect

 public function collect()
 {
     $newValue = $this->memcached->increment($this->key);
     if (false !== $newValue) {
         return $this;
     }
     if (\Memcached::RES_NOTFOUND !== $this->memcached->getResultCode()) {
         throw new \Exception('Error collecting value');
     }
     $this->memcached->set($this->key, 1, time() + $this->timeInterval);
 }
开发者ID:sokil,项目名称:php-fraud-detect,代码行数:11,代码来源:MemcachedCollector.php

示例13: getItem

 /**
  * Gets item from Memcached.
  *
  * @param string $key under which the item is stored
  *
  * @return mixed
  * @throws \iveeCrest\Exceptions\KeyNotFoundInCacheException if key is not found
  */
 public function getItem($key)
 {
     $item = $this->memcached->get(md5($this->uniqId . '_' . $key));
     if ($this->memcached->getResultCode() == \Memcached::RES_NOTFOUND) {
         $exceptionClass = Config::getIveeClassName('KeyNotFoundInCacheException');
         throw new $exceptionClass("Key not found in memcached.");
     }
     //count memcached hit
     $this->hits++;
     return $item;
 }
开发者ID:plugh3,项目名称:eve-trade1-perl,代码行数:19,代码来源:MemcachedWrapper.php

示例14: read

 /**
  * @param string $name
  * @param mixed $defaultValue
  * @return string
  */
 public function read($name, $defaultValue = null)
 {
     if (!$this->memcached instanceof \Memcached) {
         $this->connect();
     }
     $result = $this->memcached->get($name);
     if ($result === false && $this->memcached->getResultCode() === \Memcached::RES_NOTFOUND) {
         return $defaultValue;
     } else {
         return $result;
     }
 }
开发者ID:hergot,项目名称:databroker,代码行数:17,代码来源:MemcachedCacheBackend.php

示例15: check

 /**
  * @return bool
  */
 public function check()
 {
     if (array_key_exists($this->key, static::$cache)) {
         return true;
     }
     $value = $this->memcached->get($this->key);
     if ($this->memcached->getResultCode() == Memcached::RES_SUCCESS) {
         static::$cache[$this->key] = $value;
         return true;
     }
     return false;
 }
开发者ID:brightfishsoftware,项目名称:haplomvc,代码行数:15,代码来源:HaploMemcachedCache.php


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