Exemplo n.º 1
0
 public function getMicrotime()
 {
     if (fseek($this->fileHandle, 0) !== 0) {
         throw new StorageException("Could not move to beginning of the file.");
     }
     $data = fread($this->fileHandle, 8);
     if ($data === false) {
         throw new StorageException("Could not read from storage.");
     }
     $converter = new StringToDoubleConverter();
     return $converter->convert($data);
 }
Exemplo n.º 2
0
 public function getMicrotime()
 {
     try {
         $data = $this->redis->get($this->key);
         if ($data === false) {
             throw new StorageException("Failed to get microtime");
         }
         $converter = new StringToDoubleConverter();
         return $converter->convert($data);
     } catch (RedisException $e) {
         throw new StorageException("Failed to get microtime", 0, $e);
     }
 }
Exemplo n.º 3
0
 public function getMicrotime()
 {
     $data = shm_get_var($this->memory, 0);
     if ($data === false) {
         throw new StorageException("Could not read from shared memory.");
     }
     $converter = new StringToDoubleConverter();
     return $converter->convert($data);
 }