add() public method

public add ( string $key, mixed $value, integer $expire )
$key string
$value mixed
$expire integer
Example #1
0
 /**
  * {@inheritdoc}
  */
 public function add($key, $value, $expire = 0)
 {
     // before adding, make sure the value doesn't yet exist (in real cache,
     // nor in memory)
     if ($this->get($key) !== false) {
         return false;
     }
     // store the value in memory, so that when we ask for it again later
     // in this same request, we get the value we just set
     $success = $this->local->set($key, $value, $expire);
     if ($success === false) {
         return false;
     }
     $this->defer->add($key, $value, $expire);
     return true;
 }