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


PHP Memcached::set方法代码示例

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


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

示例1: set

 /**
  * Store data on the cache server.
  *
  * @param string       $key        Key we can use to retrieve the data.
  * @param string|array $data       Data to store on the cache server.
  * @param int          $expiration Time before the data expires on the cache server.
  *
  * @return bool Success/Failure.
  * @access public
  */
 public function set($key, $data, $expiration)
 {
     if ($this->connected === true && $this->ping() === true) {
         return $this->server->set($key, $this->isRedis ? $this->IgBinarySupport ? igbinary_serialize($data) : serialize($data) : $data, $expiration);
     }
     return false;
 }
开发者ID:sebst3r,项目名称:nZEDb,代码行数:17,代码来源:Cache.php

示例2: set

 /**
  * {@inheritdoc}
  */
 public function set($key, $value, $ttl = null)
 {
     if (!$ttl) {
         $ttl = $this->ttl;
     }
     $this->server->set($this->getKey($key), $this->pack($value), time() + $ttl);
 }
开发者ID:evolutionscript,项目名称:Cache,代码行数:10,代码来源:Memcached.php

示例3: save

 /**
  * save
  *
  * @param mixed  $identifier identifier to save
  * @param string $amount     the current amount
  * @param string $timespan   the timespan in seconds
  *
  * @return boolean
  */
 public function save($identifier = null, $amount = null, $timespan = null)
 {
     if (!$identifier && !$amount && !$timespan) {
         throw new \InvalidArgumentException('identifier, amount and timespan are required');
     }
     return $this->memcached->set($this->fileName($identifier), $amount, $timespan);
 }
开发者ID:websoftwares,项目名称:throttle,代码行数:16,代码来源:Memcached.php

示例4: _set

 /**
  * @see Cache::_set()
  */
 protected function _set($key, $value, $ttl = 0)
 {
     if (!$this->is_connected) {
         return false;
     }
     return $this->memcached->set($key, $value, $ttl);
 }
开发者ID:nmardones,项目名称:PrestaShop,代码行数:10,代码来源:CacheMemcached.php

示例5: set

 /**
  * @param string $key
  * @param mixed $var
  * @param int $expiration
  * @return bool True on success, false on failure
  */
 public function set($key, $var, $expiration = null)
 {
     if (!$this->memcached) {
         throw new CacheException('No memcached defined.');
     }
     return $this->memcached->set($key, $var, $expiration === null ? 0 : $expiration);
 }
开发者ID:enyo,项目名称:rincewind,代码行数:13,代码来源:MemcachedCache.php

示例6: set

 /**
  * Set a value against a key in the cache.
  *
  * @param string $key     The key to store against
  * @param string $value   A json_encoded value
  * @param int    $expires Optional expiry time in seconds from now
  */
 public function set($key, $value = null, $expires = 0)
 {
     if ($value === null) {
         return $this->clear($key);
     }
     return $this->client->set($key, $value, $expires);
 }
开发者ID:molovo,项目名称:amnesia,代码行数:14,代码来源:Memcached.php

示例7: set

 /**
  * @param $key
  * @param $data
  * @return bool
  */
 public function set($key, $data)
 {
     if (!is_null($this->memcache)) {
         $this->memcache->set($key, $data, $this->expire);
     }
     return false;
 }
开发者ID:ineersa,项目名称:currency-converter,代码行数:12,代码来源:MemcacheCache.php

示例8: set

 /**
  * Set a value in the cache
  *
  * @param string $p_sKey The Key
  * @param mixed $p_mData The Data
  * @param integer $p_mTTL The Time To Live
  * @return boolean
  */
 function set($p_sKey, $p_mData, $p_mTTL = 0)
 {
     if ($this->_serverAdded === false) {
         $this->addServer('localhost');
     }
     return $this->_handler->set($p_sKey, $p_mData, is_numeric($p_mTTL) ? $p_mTTL : strtotime($p_mTTL));
 }
开发者ID:revolveweb,项目名称:ppi-framework,代码行数:15,代码来源:Memcached.php

示例9: setExpired

 /**
  * set cache-item by key => value + ttl
  *
  * @param string $key
  * @param mixed  $value
  * @param int    $ttl
  *
  * @return boolean
  */
 public function setExpired($key, $value, $ttl)
 {
     if ($ttl > 2592000) {
         $ttl = 2592000;
     }
     return $this->memcached->set($key, $value, $ttl);
 }
开发者ID:hhgr,项目名称:hhgolf,代码行数:16,代码来源:AdapterMemcached.php

示例10: put

 /**
  * @inheritdoc
  */
 public function put($key, $value, $ttl = 0)
 {
     if ($ttl > 30 * 24 * 3600) {
         $ttl = time() + $ttl;
     }
     return $this->memcached->set($key, $value, 0, (int) $ttl);
 }
开发者ID:lixiongyou,项目名称:pudding,代码行数:10,代码来源:Memcached.php

示例11: set

 /**
  * Store an item in the cache for a given number of minutes.
  *
  * @param  string $key
  * @param  mixed $value
  * @param  int $seconds
  * @param  bool $strict
  *
  * @throws CacheSetException
  *
  * @return bool
  */
 public function set($key, $value, $seconds, $strict = true)
 {
     $set = $this->memcached->set($key, $value, $seconds);
     if (!$set && $strict) {
         throw new CacheSetException($key);
     }
 }
开发者ID:wucdbm,项目名称:wucdbm-bundle,代码行数:19,代码来源:MemcachedStorage.php

示例12: Set

 /**
  * Sets an item into the cache
  *
  * @param string $key cache key
  * @param mixed $value object to cache
  * @param int $lifetime cached object lifetime
  */
 public function Set($key, $value, $lifetime)
 {
     if (empty($key) || empty($value)) {
         return;
     }
     $this->memcache->set($key, $value, false, time() + $lifetime);
 }
开发者ID:fboender,项目名称:gitphp,代码行数:14,代码来源:Cache_Memcache.class.php

示例13: set

 public function set($id, $value, $ttl = null)
 {
     $ttl = $ttl ?: 0;
     if ($ttl > 0) {
         $ttl = time() + $ttl;
     }
     return $this->memcached->set($id, $value, $ttl);
 }
开发者ID:maximebf,项目名称:cachecache,代码行数:8,代码来源:Memcached.php

示例14: set

 public function set($key, $value, $ttl = 0)
 {
     if ($ttl > 0) {
         return self::$cache->set($this->getNamespace() . $key, $value, $ttl);
     } else {
         return self::$cache->set($this->getNamespace() . $key, $value);
     }
 }
开发者ID:brunomilet,项目名称:owncloud-core,代码行数:8,代码来源:memcached.php

示例15: setUp

 public function setUp()
 {
     self::$memcached->flush();
     self::$memcached->quit();
     self::$memcached->set('found', array('count' => 5, 'time' => strtotime('2015-01-01 00:00:00')));
     self::$memcached->set('oldkey', 'old story');
     $this->storage = new MemcachedStorage(self::$memcached);
 }
开发者ID:fustundag,项目名称:tokenbucket,代码行数:8,代码来源:MemcachedTest.php


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