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); }
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); } }
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); }