當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。