Example #1
0
 /**
  * {@inheritdoc}
  */
 public function getItem($key)
 {
     $item = new TextCacheItem($key);
     if (!$this->hasItem($key)) {
         return $item;
     }
     $data = explode(';', file_get_contents("{$this->cacheFolder}/{$key}.txt"));
     return $item->set($data[0])->expiresAt(new \DateTime($data[1]));
 }
Example #2
0
 public function testExpiresAfter()
 {
     $time = time() + 1500;
     $this->item->expiresAfter(1500);
     $this->assertEquals($time, $this->item->getExpirationDate()->getTimestamp());
 }