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


PHP Memcached::getOption方法代碼示例

本文整理匯總了PHP中Memcached::getOption方法的典型用法代碼示例。如果您正苦於以下問題:PHP Memcached::getOption方法的具體用法?PHP Memcached::getOption怎麽用?PHP Memcached::getOption使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Memcached的用法示例。


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

示例1: write

 /**
  * {@inheritdoc}
  */
 public function write($key, $data, $expires = 60, $compressed = false)
 {
     $cmp = $this->driver->getOption(Memcached::OPT_COMPRESSION);
     $this->driver->setOption(Memcached::OPT_COMPRESSION, $compressed);
     $cached = $this->driver->set($key, $data, $expires);
     $this->driver->setOption(Memcached::OPT_COMPRESSION, $cmp);
     return $cached;
 }
開發者ID:lucidphp,項目名稱:cache,代碼行數:11,代碼來源:Memcached.php

示例2: __construct

 public function __construct()
 {
     $this->connect();
     if ($this->is_connected) {
         $this->memcached->setOption(Memcached::OPT_PREFIX_KEY, _DB_PREFIX_);
         if ($this->memcached->getOption(Memcached::HAVE_IGBINARY)) {
             $this->memcached->setOption(Memcached::OPT_SERIALIZER, Memcached::SERIALIZER_IGBINARY);
         }
     }
 }
開發者ID:nmardones,項目名稱:PrestaShop,代碼行數:10,代碼來源:CacheMemcached.php

示例3: _doDelete

 /**
  * Remove a cache record directly. This method is implemented by the cache
  * drivers and used in Doctrine_Cache_Driver::delete()
  *
  * @param string $id cache id
  * @return boolean true if no problem
  */
 protected function _doDelete($id)
 {
     if (false == $this->_memcached->getOption(Memcached::OPT_BINARY_PROTOCOL)) {
         $id = str_replace(' ', '_', $id);
     }
     return $this->_memcached->delete($id);
 }
開發者ID:endelwar,項目名稱:doctrine1-addons,代碼行數:14,代碼來源:Memcached.php

示例4: has

 /**
  * {@inheritdoc }
  */
 public function has($key)
 {
     /* It seems that the most efficient way to check has in memcached is
        by using an append with an empty string. However, we need to make
        sure that OPT_COMPRESSION is turned off because you can't append
        if you compressing data */
     /* store for later use */
     $cur_compression = $this->adapter->getOption(BaseMemcached::OPT_COMPRESSION);
     /* set compression off */
     $this->adapter->setOption(BaseMemcached::OPT_COMPRESSION, false);
     $res = $this->adapter->append($this->buildKey($key), '');
     $this->adapter->setOption(BaseMemcached::OPT_COMPRESSION, $cur_compression);
     return $res;
 }
開發者ID:BrightLocal,項目名稱:Cache,代碼行數:17,代碼來源:Memcached.php

示例5: 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

示例6: getOption

 /**
  * Retrieve a Memcached option value.
  *
  * @link http://www.php.net/manual/en/memcached.getoption.php
  *
  * @param   int         $option     One of the Memcached::OPT_* constants.
  * @return  mixed                   Returns the value of the requested option, or FALSE on error.
  */
 public function getOption($option)
 {
     return $this->m->getOption($option);
 }
開發者ID:AlwaysOnline,項目名稱:wordpress-pecl-memcached-object-cache,代碼行數:12,代碼來源:object-cache.php

示例7: Memcached

<?php

$mc = new Memcached();
$mc->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
var_dump($mc->getOption(Memcached::OPT_HASH) === Memcached::HASH_MD5);
var_dump($mc->getOption(Memcached::OPT_DISTRIBUTION) === Memcached::DISTRIBUTION_CONSISTENT_WEIGHTED);
$mc->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, false);
var_dump($mc->getOption(Memcached::OPT_HASH) === Memcached::HASH_DEFAULT);
var_dump($mc->getOption(Memcached::OPT_DISTRIBUTION) === Memcached::DISTRIBUTION_MODULA);
開發者ID:jeremyadoux,項目名稱:hhvm,代碼行數:9,代碼來源:ketama_opt.php

示例8: Memcached

<?php

$memc1 = new Memcached("test");
$memc1->setOption(Memcached::OPT_PREFIX_KEY, 'php');
var_dump($memc1->getOption(Memcached::OPT_PREFIX_KEY));
$memc2 = new Memcached("test");
var_dump($memc2->getOption(Memcached::OPT_PREFIX_KEY));
$memc3 = new Memcached();
var_dump($memc3->getOption(Memcached::OPT_PREFIX_KEY));
開發者ID:lsqtongxin,項目名稱:hhvm,代碼行數:9,代碼來源:construct_persistent.php

示例9: Memcached

<?php

$mc = new Memcached();
var_dump(Memcached::OPT_HASH_WITH_PREFIX_KEY);
var_dump($mc->getOption(Memcached::OPT_HASH_WITH_PREFIX_KEY));
var_dump($mc->setOption(Memcached::OPT_HASH_WITH_PREFIX_KEY, true));
var_dump($mc->getOption(Memcached::OPT_HASH_WITH_PREFIX_KEY));
開發者ID:badlamer,項目名稱:hhvm,代碼行數:7,代碼來源:opt_hash_with_prefix_key.php

示例10: getOption

 /**
  * Retrieve a daemon option value.
  *
  * @link http://www.php.net/manual/en/memcached.getoption.php
  *
  * @param   int         $option     One of the Memcached::OPT_* constants.
  * @return  mixed                   Returns the value of the requested option, or FALSE on error.
  */
 public function getOption($option)
 {
     return $this->daemon->getOption($option);
 }
開發者ID:benediktharter,項目名稱:wp-spider-cache,代碼行數:12,代碼來源:class-object-cache.php


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