/** * @SuppressWarnings(PHPMD) */ 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."); } return DoublePacker::unpack($data); }
/** * @SuppressWarnings(PHPMD) */ public function getMicrotime() { try { $data = $this->redis->get($this->key); if ($data === false) { throw new StorageException("Failed to get microtime"); } return DoublePacker::unpack($data); } catch (PredisException $e) { throw new StorageException("Failed to get microtime", 0, $e); } }
/** * @SuppressWarnings(PHPMD) */ public function getMicrotime() { $data = shm_get_var($this->memory, 0); if ($data === false) { throw new StorageException("Could not read from shared memory."); } return DoublePacker::unpack($data); }