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


PHP Memcache::set方法代码示例

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


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

示例1: update

 /**
  * Update a part of a document
  *
  * @return array
  * @param  array $partialDocument
  * @param  mixed $id
  * @param  array $options
  */
 public function update($partialDocument, $id, $options = array())
 {
     $document = json_encode(array('doc' => $partialDocument));
     $url = $this->buildUrl(array($this->type, $id));
     $response = $this->conn->set($url, $document);
     return array('ok' => $response);
 }
开发者ID:xhinliang,项目名称:elasticyii,代码行数:15,代码来源:ElasticSearchMemcached.php

示例2: _set

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

示例3: set

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

示例4: set

 /**
  * @param  mixed $data Data to put in cache
  * @param  string $id Cache id
  * @param  int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
  * @throws App_Cache_Memcached_Exception
  * @return boolean True if no problem
  */
 public function set($id, $data, $specificLifetime = false, $tags = array())
 {
     if (!$data) {
         return false;
     }
     if (!$id) {
         throw new App_Cache_Memcached_Exception('ID can`t be NULL');
     }
     self::_validateIdOrTag($id);
     $lifetime = $this->getLifetime($specificLifetime);
     if ($tags) {
         $cols = 'cache_id,tag';
         $values = [];
         $db = $this->_options['db'];
         $sqlId = $db->quote($id);
         foreach ($tags as $tag) {
             $values[] = '(' . $sqlId . ',' . $db->quote($tag) . ')';
         }
         $sql = "INSERT IGNORE INTO " . $db->quoteIdentifier($this->_options['tagsTableName'], true) . ' (' . $cols . ') ' . 'VALUES ' . implode(', ', $values);
         $db->query($sql);
     }
     $result = $this->_memcached->set($id, $data, $lifetime);
     if (!$result) {
         $this->remove($id, true);
         return false;
     }
     return true;
 }
开发者ID:villos,项目名称:tree_admin,代码行数:35,代码来源:Memcached.php

示例5: set

 /**
  * @see ICache::set()
  */
 public function set($key, $content, $expire = null)
 {
     if ($expire !== null) {
         $this->configs['expire'] = $expire;
     }
     return self::$Mem->set($key, $content, MEMCACHE_COMPRESSED, $this->configs['expire']);
 }
开发者ID:jifangshiyanshi,项目名称:tuonews,代码行数:10,代码来源:MemoCache.class.php

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

示例7: set

 public function set($key, $value, $expire = '')
 {
     if (!$expire) {
         $expire = $this->config['expire'];
     }
     return $this->instance->set($key, $value, 0, $expire);
 }
开发者ID:kellenqian,项目名称:axion,代码行数:7,代码来源:memcached.class.php

示例8: checkCache

 function checkCache($check = 0, $in, $out, $set = 0)
 {
     $inOut = 'inOut_' . $in . '_' . $out;
     $memcache_obj = new Memcache();
     $memcache_obj->connect('127.0.0.1', 11211) or die("Could not connect");
     if ($check === 1) {
         $available = $memcache_obj->get($inOut);
         if (!$available) {
             $set = $this->superfastCheck(1, $in, $out);
             $memcache_obj->set($inOut, $set, false, 324);
             $available = $memcache_obj->get($inOut);
         }
     } elseif ($check === 2) {
         $memcache_obj->flush();
     } else {
         $set = $this->superfastCheck($in, $out);
         //var_dump($set);
         $memcache_obj->set($inOut, $set, false, 324);
         //echo $inOut;
         $available = $memcache_obj->get($inOut);
         //var_dump($memcache_obj->getStats());
     }
     //var_dump($available);
     $memcache_obj->close();
     return $available;
 }
开发者ID:Asgart,项目名称:testapi,代码行数:26,代码来源:cache.php

示例9: set

 /**
  * {@inheritDoc}
  */
 public function set($key, $value, $timeout = null)
 {
     if (is_null($timeout)) {
         $timeout = static::DEFAULT_TIMEOUT;
     }
     return $this->memcache->set($key, $value, MEMCACHE_COMPRESSED, $timeout);
 }
开发者ID:urodoz,项目名称:cachemanager,代码行数:10,代码来源:MemcacheImplementation.php

示例10: _updateValue

 /**
  * Write a line to the logfile.
  * @param String $line
  */
 protected function _updateValue($message, $keyPostfix = "")
 {
     $key = $this->_getKey($keyPostfix);
     $value = $this->_memcache->get($key);
     $value .= self::VALUE_SEPARATOR . $message;
     $this->_memcache->set($key, $value, null, $this->_expiry);
 }
开发者ID:newlongwhitecloudy,项目名称:OpenConext-engineblock,代码行数:11,代码来源:Memcache.php

示例11: put

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

示例12: set

 public function set($key, $value, $ttl = null)
 {
     if (is_resource($value)) {
         return false;
     }
     return true === $this->memcache->set(self::normalizeKey($key), $value, 0, self::normalizeTtl($ttl));
 }
开发者ID:yrizos,项目名称:stockpile,代码行数:7,代码来源:Memcache.php

示例13: setExpired

 /**
  * @inheritdoc
  */
 public function setExpired($key, $value, $ttl)
 {
     if ($ttl > 2592000) {
         $ttl = 2592000;
     }
     $this->memcache->set($key, $value, $this->getCompressedFlag(), $ttl);
 }
开发者ID:sibset,项目名称:cache,代码行数:10,代码来源:MemcacheAdapter.php

示例14: set

 /**
  * Adds a cache with an unique Id.
  *
  * @param string $id Cache Id
  * @param mixed $data Data to be stored
  * @param int $expire Seconds to expired
  * @param int $compressed To store the data in Zlib compressed format
  * @return bool True if success
  */
 public function set($id, $data, $expire = 0, $compressed = false)
 {
     if ($compressed) {
         return $this->_memcache->set($id, $data, MEMCACHE_COMPRESSED, $expire);
     } else {
         return $this->_memcache->set($id, $data, 0, $expire);
     }
 }
开发者ID:garv347,项目名称:swanhart-tools,代码行数:17,代码来源:DooMemCache.php

示例15: write

 public function write($id, $data)
 {
     if ($this->injectors['lifetime']) {
         return $this->redis->setex(strtr($this->injectors['name'], array(':id' => $id)), $this->injectors['lifetime'], $data);
     } else {
         return $this->redis->set(strtr($this->injectors['name'], array(':id' => $id)), $data);
     }
 }
开发者ID:pagon,项目名称:framework,代码行数:8,代码来源:Redis.php


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