当前位置: 首页>>代码示例>>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;未经允许,请勿转载。