/** * @SuppressWarnings(PHPMD) */ public function setMicrotime($microtime) { try { $data = DoublePacker::pack($microtime); if (!$this->redis->set($this->key, $data)) { throw new StorageException("Failed to store microtime"); } } catch (PredisException $e) { throw new StorageException("Failed to store microtime", 0, $e); } }
/** * @SuppressWarnings(PHPMD) */ public function setMicrotime($microtime) { if (fseek($this->fileHandle, 0) !== 0) { throw new StorageException("Could not move to beginning of the file."); } $data = DoublePacker::pack($microtime); $result = fwrite($this->fileHandle, $data, strlen($data)); if ($result !== strlen($data)) { throw new StorageException("Could not write to storage."); } }
/** * @SuppressWarnings(PHPMD) */ public function setMicrotime($microtime) { $data = DoublePacker::pack($microtime); if (!shm_put_var($this->memory, 0, $data)) { throw new StorageException("Could not store in shared memory."); } }