Exemple #1
0
 /**
  * @param string $id
  * @return string
  * @throws StorageException
  */
 public function read(string $id) : string
 {
     $read = $this->cache->get("sess_" . $id);
     if (empty($read)) {
         throw StorageException::readError(__METHOD__, 'Not found');
     }
     return $read;
 }
Exemple #2
0
 /**
  * @param string $id
  * @return string
  * @throws StorageException
  */
 public function read(string $id) : string
 {
     $read = call_user_func([$this, "findById"], $id);
     if (!is_array($read) || !array_key_exists("payload", $read) || empty($read["payload"])) {
         throw StorageException::readError(__METHOD__, 'Not found');
     }
     return $read["payload"];
 }