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


PHP Memcached::getResultMessage方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     $this->memcache = new \Memcached();
     $this->memcache->addServer(self::TEST_MEMCACHE_SERVER, self::TEST_MEMCACHE_PORT);
     $this->memcache->flush();
     if (!$this->memcache->set('test', 1, time() + 100)) {
         throw new \RuntimeException('Cannot save item to memcache. ' . $this->memcache->getResultMessage());
     }
 }
开发者ID:hergot,项目名称:databroker,代码行数:10,代码来源:MemcachedCacheBackendTest.php

示例2: _execute

 /**
  * {@inheritDoc}
  */
 protected function _execute(\Closure $action, $operation, $key_or_keys, $mutable = false, $value = null)
 {
     $result = parent::_execute($action, $operation, $key_or_keys, $mutable, $value);
     // Adapter connection itself will only report correctly when not currently buffering results
     if (!$this->isBuffering()) {
         $code = $this->_connection->getResultCode();
         if ($code !== \Memcached::RES_SUCCESS) {
             $this->_handleFailure($this->_connection->getResultMessage(), null, null, $code);
         }
     }
     // if !isBuffering
     return $result;
 }
开发者ID:behance,项目名称:nbd.php-cache,代码行数:16,代码来源:MemcachedAdapter.php

示例3: __construct

 public function __construct($host, $port, $id = 'story_pool')
 {
     parent::__construct($id);
     if (!parent::addServer($host, $port)) {
         throw new Exception("Could not connect memcached server {$host}:{$port}." . "\n" . 'Error code: ' . parent::getResultCode() . "\n" . ' Error message: ' . parent::getResultMessage());
     }
     parent::setOption(Memcached::OPT_BINARY_PROTOCOL, true);
 }
开发者ID:aprikyblue,项目名称:PHP-Conditional-Reverse-Proxy,代码行数:8,代码来源:gateway_memcached.php

示例4: verifyReturnCode

 /**
  * @throws \Exception
  */
 private function verifyReturnCode()
 {
     $code = self::$cache->getResultCode();
     if ($code === \Memcached::RES_SUCCESS) {
         return;
     }
     $message = self::$cache->getResultMessage();
     throw new \Exception("Error {$code} interacting with memcached : {$message}");
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:12,代码来源:Memcached.php

示例5: set

 /**
  * @param $key
  * @param $value
  *
  * @return bool
  * @throws Exception
  */
 public function set($key, &$value)
 {
     $key = $this->cleanKey($key);
     if (!$this->_cache->set($key, $value, $this->_timeout)) {
         CRM_Core_Error::debug('Result Code: ', $this->_cache->getResultMessage());
         CRM_Core_Error::fatal("memcached set failed, wondering why?, {$key}", $value);
         return FALSE;
     }
     return TRUE;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:17,代码来源:Memcached.php

示例6: addServer

 /**
  * Add a Memcached server to stack
  *
  * @param   string          $server         Server address (or IP)
  * @param   string          $port           Server port
  * @param   string          $weight         Server weight
  */
 private function addServer($server, $port, $weight)
 {
     $status = $this->instance->addServer($server, $port, $weight);
     if ($status === false) {
         $this->raiseError("Error communicating with server", array("RESULTCODE" => $this->instance->getResultCode(), "RESULTMESSAGE" => $this->instance->getResultMessage()));
     }
     if (sizeof($this->instance->getServerList()) == 0) {
         $this->raiseError("No available server, disabling cache administratively");
         $this->disable();
     } else {
         $this->enable();
     }
 }
开发者ID:comodojo,项目名称:cache,代码行数:20,代码来源:MemcachedCache.php

示例7: GetMemCachedObj

function GetMemCachedObj()
{
    static $MemCachedObj;
    if (!$MemCachedObj) {
        $MemCachedObj = new Memcached();
        if (!$MemCachedObj->addServer(MEMCACHED_HOST, MEMCACHED_PORT)) {
            throw new Exception('No se pudo conectar al Memcached: ' . $MemCachedObj->getResultMessage() . '.');
        }
        $MemCachedObj->setOption(Memcached::OPT_COMPRESSION, false);
        $MemCachedObj->setOption(Memcached::OPT_BINARY_PROTOCOL, false);
        $MemCachedObj->setOption(Memcached::OPT_CONNECT_TIMEOUT, 10000);
    }
    return $MemCachedObj;
}
开发者ID:EsquemasCom,项目名称:semaphore,代码行数:14,代码来源:semaphore.php

示例8: all

 /**
  * @param  array
  * @throws RunTimeException
  * @return array
  */
 public function all(array $ids)
 {
     $this->keys = array();
     $this->keys = preg_filter('/^/', $this->table . '_', $ids);
     $data = $this->Memcached->getMulti($this->keys);
     if ($data === false) {
         $msg = $this->Memcached->getResultMessage();
         $code = $this->Memcached->getResultCode();
         throw new \RunTimeException("Memcached Error (all): " . $msg . "(" . $code . ")");
     }
     $result = array();
     foreach ($data as $key => $val) {
         $result[str_replace($this->table . '_', '', $key)] = json_decode(gzuncompress($val), true);
     }
     return $result;
 }
开发者ID:jessecascio,项目名称:spider,代码行数:21,代码来源:Memcached.php

示例9: get

 /**
  * Retrieves data from the cache identified by the specified key
  *
  * @param string $key   The key.
  *
  * @return mixed
  *
  * @throws \YapepBase\Exception\StorageException      On error.
  */
 public function get($key)
 {
     $debugger = Application::getInstance()->getDiContainer()->getDebugger();
     $startTime = microtime(true);
     $result = $this->memcache->get($this->makeKey($key));
     if (false === $result) {
         $code = $this->memcache->getResultCode();
         if (\Memcached::RES_NOTFOUND !== $code && \Memcached::RES_SUCCESS !== $code) {
             throw new StorageException('Unable to get value in memcache. Error: ' . $this->memcache->getResultMessage(), $this->memcache->getResultCode());
         }
     }
     // If we have a debugger, we have to log the request
     if (!$this->debuggerDisabled && $debugger !== false) {
         $debugger->addItem(new StorageItem('memcached', 'memcached.' . $this->currentConfigurationName, StorageItem::METHOD_GET . ' ' . $key, $result, microtime(true) - $startTime));
     }
     return $result;
 }
开发者ID:szeber,项目名称:yapep_base,代码行数:26,代码来源:MemcachedStorage.php

示例10: storeValuesImpl

    protected function storeValuesImpl(array $values, $expirationTime) {
        $errorCacheEntryNames = NULL;

        $adjustedExpirationTime = $expirationTime;
        if (!isset($adjustedExpirationTime)) {
            $adjustedExpirationTime = 0;
        }

        $storableValues = $deletableCacheEntryNames = NULL;
        foreach ($values as $cacheEntryName => $value) {
            if (isset($value)) {
                $storableValues[$cacheEntryName] = $value;
            }
            else {
                $deletableCacheEntryNames[] = $cacheEntryName;
            }
        }

        if (isset($deletableCacheEntryNames)) {
            foreach ($deletableCacheEntryNames as $deletableCacheEntryName) {
                $result = $this->memcached->delete($deletableCacheEntryName);
                if (($result === FALSE) && ($this->memcached->getResultCode() != Memcached::RES_NOTFOUND)) {
                    $errorCacheEntryNames[] = $deletableCacheEntryName;

                    LogHelper::log_error(t(
                        '[@cacheType] Internal error during value deletion: @message',
                        array('@cacheType' => self::CACHE__TYPE, '@message' => $this->memcached->getResultMessage())));
                }
            }
        }

        if (isset($storableValues)) {
            $result = $this->memcached->setMulti($storableValues, $adjustedExpirationTime);
            if ($result === FALSE) {
                LogHelper::log_error(t(
                    '[@cacheType] Internal error during value storing: @message',
                    array('@cacheType' => self::CACHE__TYPE, '@message' => $this->memcached->getResultMessage())));
                ArrayHelper::appendValue($errorCacheEntryNames, array_keys($storableValues));
            }
        }

        return $errorCacheEntryNames;
    }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:43,代码来源:MemcachedHandler.php

示例11: testAddWithPrefixSuccess

 public function testAddWithPrefixSuccess()
 {
     $memcached = new Memcached();
     $memcached->setOption(Memcached::OPT_PREFIX_KEY, "widgets_");
     $request = new MemcacheSetRequest();
     $item = $request->addItem();
     $item->setKey("widgets_float");
     $item->setValue("2");
     $item->setFlags(6);
     // float
     $item->setSetPolicy(SetPolicy::ADD);
     $item->setExpirationTime(30);
     $response = new MemcacheSetResponse();
     $response->addSetStatus(SetStatusCode::STORED);
     $this->apiProxyMock->expectCall('memcache', 'Set', $request, $response);
     $this->assertTrue($memcached->add("float", 2.0, 30));
     $this->assertEquals($memcached->getOption(Memcached::OPT_PREFIX_KEY), "widgets_");
     $this->assertEquals($memcached->getResultCode(), Memcached::RES_SUCCESS);
     $this->assertEquals($memcached->getResultMessage(), "SUCCESS");
     $this->apiProxyMock->verify();
 }
开发者ID:spudder-com,项目名称:spudder-django,代码行数:21,代码来源:MemcachedTest.php

示例12: getError

 /**
  * @return string
  */
 public function getError()
 {
     return $this->memcached->getResultMessage();
 }
开发者ID:avatarnewyork,项目名称:memcached-bundle,代码行数:7,代码来源:Memcached.php

示例13: error

 /**
  * 错误处理
  * @param $op
  * @param $key
  * @throws \Simple\Model\Exception\DbException
  */
 private function error($op, $key)
 {
     throw new DbException($op . '操作' . $key . '出错,错误码为:' . $this->dbh->getResultCode() . ',具体信息为:' . $this->dbh->getResultMessage());
 }
开发者ID:songsihan,项目名称:simple,代码行数:10,代码来源:NoSQL.php

示例14: testGetMissing

 public function testGetMissing()
 {
     $request = new MemcacheGetRequest();
     $request->addKey("key");
     $response = new MemcacheGetResponse();
     $this->apiProxyMock->expectCall('memcache', 'Get', $request, $response);
     $memcached = new Memcached();
     $this->assertFalse($memcached->get("key"));
     $this->assertEquals($memcached->getResultCode(), Memcached::RES_NOTFOUND);
     $this->assertEquals($memcached->getResultMessage(), 'NOT FOUND');
     $this->apiProxyMock->verify();
 }
开发者ID:bitcpf,项目名称:djangoage,代码行数:12,代码来源:MemcachedTest.php

示例15: resultMessage

 /**
  * {@inheritdoc}
  */
 public function resultMessage()
 {
     return $this->memcache->getResultMessage();
 }
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:7,代码来源:class.memcached.php


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