Exemplo n.º 1
0
 /**
  * Store data at the server
  *
  * CacheMemcache::put() stores an item $buff with $key on the memcached server.
  * Parameter $valid_time is expiration time in seconds. If it's 0, the item never expires
  * (but memcached server doesn't guarantee this item to be stored all the time, it could be delete from the cache to make place for other items).
  *
  * Remember that resource variables (i.e. file and connection descriptors) cannot be stored in the cache,
  * because they can not be adequately represented in serialized state.
  *
  * @param string $key The key that will be associated with the item.
  * @param mixed $buff The variable to store. Strings and integers are stored as is, other types are stored serialized.
  * @param int $valid_time 	Expiration time of the item.
  *							You can also use Unix timestamp or a number of seconds starting from current time, but in the latter case the number of seconds may not exceed 2592000 (30 days).
  *							If it's equal to zero, use the default valid time CacheMemcache::valid_time.
  * @return bool Returns true on success or false on failure.
  */
 function put($key, $buff, $valid_time = 0)
 {
     if ($valid_time == 0) {
         $valid_time = $this->valid_time;
     }
     return $this->Memcache->set($this->getKey($key), array(time(), $buff), MEMCACHE_COMPRESSED, $valid_time);
 }
Exemplo n.º 2
0
 /**
  * Store data at the server
  *
  * CacheMemcache::put() stores an item $buff with $key on the memcached server.
  * Parameter $valid_time is expiration time in seconds. If it's 0, the item never expires
  * (but memcached server doesn't guarantee this item to be stored all the time, it could be delete from the cache to make place for other items).
  *
  * Remember that resource variables (i.e. file and connection descriptors) cannot be stored in the cache,
  * because they can not be adequately represented in serialized state.
  *
  * @param string $key The key that will be associated with the item.
  * @param mixed $buff The variable to store. Strings and integers are stored as is, other types are stored serialized.
  * @param int $valid_time 	Expiration time of the item.
  * 							You can also use Unix timestamp or a number of seconds starting from current time, but in the latter case the number of seconds may not exceed 2592000 (30 days).
  * 							If it's equal to zero, use the default valid time CacheMemcache::valid_time.
  * @return bool Returns true on success or false on failure.
  */
 function put($key, $buff, $valid_time = 0)
 {
     if ($valid_time == 0) {
         $valid_time = $this->valid_time;
     }
     return $this->Memcache->set($this->getKey($key), array($_SERVER['REQUEST_TIME'], $buff), MEMCACHE_COMPRESSED, $valid_time);
 }
Exemplo n.º 3
0
 /**
  * Store data at the server
  *
  * CacheMemcache::put() stores an item $buff with $key on the memcached server.
  * Parameter $valid_time is expiration time in seconds. If it's 0, the item never expires
  * (but memcached server doesn't guarantee this item to be stored all the time, it could be delete from the cache to make place for other items).
  *
  * Remember that resource variables (i.e. file and connection descriptors) cannot be stored in the cache,
  * because they can not be adequately represented in serialized state.
  *
  * @param string $key The key that will be associated with the item.
  * @param mixed $buff The variable to store. Strings and integers are stored as is, other types are stored serialized.
  * @param int $valid_time 	Expiration time of the item.
  * 							You can also use Unix timestamp or a number of seconds starting from current time, but in the latter case the number of seconds may not exceed 2592000 (30 days).
  * 							If it's equal to zero, use the default valid time CacheMemcache::valid_time.
  * @return bool Returns true on success or false on failure.
  */
 function put($key, $buff, $valid_time = 0)
 {
     if ($valid_time == 0) {
         $valid_time = $this->valid_time;
     }
     if ($this->SelectedExtension === 'Memcached') {
         return $this->Memcache->set($this->getKey($key), array($_SERVER['REQUEST_TIME'], $buff), $valid_time);
     } else {
         return $this->Memcache->set($this->getKey($key), array($_SERVER['REQUEST_TIME'], $buff), MEMCACHE_COMPRESSED, $valid_time);
     }
 }