/**
  * @param string $key
  * @param \DateTime $time
  *
  * @return bool
  */
 public function set($key, \DateTime $time)
 {
     $sh = new BlockShmop($this->getIdByKey($key), 10);
     if (!($old_time = $sh->read()) || $old_time < $time->getTimestamp()) {
         $sh->write($time->getTimestamp());
     }
     return true;
 }
Exemple #2
0
 public function testDelete()
 {
     $this->fb->write(self::WORD);
     $this->assertTrue($this->fb->delete());
     $this->fb = null;
     // new object
     $fb = new FixedBlock(self::SHMOP_ID, 3);
     $this->assertEmpty($fb->read());
 }