コード例 #1
0
 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);
     }
 }
コード例 #2
0
 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.");
     }
 }
コード例 #3
0
 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.");
     }
 }