public function setMicrotime($microtime) { try { $converter = new DoubleToStringConverter(); $data = $converter->convert($microtime); if (!$this->redis->set($this->key, $data)) { throw new StorageException("Failed to store microtime"); } } catch (RedisException $e) { throw new StorageException("Failed to store microtime", 0, $e); } }
public function setMicrotime($microtime) { if (fseek($this->fileHandle, 0) !== 0) { throw new StorageException("Could not move to beginning of the file."); } $converter = new DoubleToStringConverter(); $data = $converter->convert($microtime); $result = fwrite($this->fileHandle, $data, strlen($data)); if ($result !== strlen($data)) { throw new StorageException("Could not write to storage."); } }
public function setMicrotime($microtime) { $converter = new DoubleToStringConverter(); $data = $converter->convert($microtime); if (!shm_put_var($this->memory, 0, $data)) { throw new StorageException("Could not store in shared memory."); } }