save() public method

Save variable in memory storage
public save ( string $key, mixed $value, integer $ttl = 259200, array | string $tags = NULL ) : boolean
$key string - key
$value mixed - value
$ttl integer - time to live (store) in seconds
$tags array | string - array of tags for this key
return boolean
Example #1
0
 protected function setTableInfoInCache($info)
 {
     if (empty($this->CacheObject)) {
         return false;
     }
     return $this->CacheObject->save($this->cache_key_info . ':' . $this->name, $info, $this->cache_ttl);
 }
Example #2
0
 public function getNextError()
 {
     if ($this->storage->acquire_key($this->cache_key, $auto_unlocker)) {
         $messages = $this->storage->read($this->cache_key);
         if (empty($messages)) {
             return false;
         }
         if (!is_array($messages)) {
             $this->FlushLog();
             return $messages;
         }
         $message = array_shift($messages);
         $this->storage->save($this->cache_key, $messages, $this->log_ttl);
         return $message;
     }
     return false;
 }