Exemple #1
0
 /**
  * если передают массив, то переводим его в строку
  * 
  * @param string $id
  * @param string $data
  * @param int $lifetime
  * @return bool
  */
 public function set($id, $data, $lifetime = 3600)
 {
     if (is_array($data)) {
         $data = json_encode($data);
     }
     return parent::set($id, $data, $lifetime);
 }
Exemple #2
0
 /**
  * Sets a Kohana Response to be cached by
  * the decorator with a key. The decorator must
  * handle the expiration logic.
  *
  *     // Set a value to the decorator
  *     $decorator->set('foo', $bar);
  *
  * @param   string   key
  * @param   Kohana_Response response
  * @return  boolean
  */
 public function set($key, Kohana_Response $response)
 {
     return $this->_cache->set($key, $this->_prepare_response($response), $this->_lifetime);
 }
 /**
  * Saves the circuit status to the driver.
  *
  * @param   string   name of the circuit
  * @param   array    status to save to the circuit
  * @return  boolean
  */
 public function save($circuit_name, array $status)
 {
     return $this->_cache->set($this->_create_cache_key($circuit_name), $status, CircuitBreaker_Native::$cache_life);
 }