read() public method

Read data from memory storage
public read ( string | array $key, mixed &$ttl_left ) : mixed
$key string | array (string or array of string keys)
$ttl_left mixed = (ttl - time()) of key. Use to exclude dog-pile effect, with lock/unlock_key methods.
return mixed
Example #1
0
 public function semaphore_exists()
 {
     $sem = $this->mem->read($this->key_semaphore);
     if (empty($sem)) {
         return false;
     }
     return true;
 }
Example #2
0
 protected function getTableInfoFromCache()
 {
     if (empty($this->CacheObject)) {
         return false;
     }
     return $this->CacheObject->read($this->cache_key_info . ':' . $this->name);
 }
Example #3
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;
 }