Esempio n. 1
0
 public function write(CacheItemInterface $item)
 {
     if ($item->hasExpiration()) {
         $ttl = $item->getExpiration()->getTimestamp();
     } else {
         $ttl = 0;
     }
     $this->memcache->set($item->getKey(), $item->get(), 0, $ttl);
 }
Esempio n. 2
0
File: File.php Progetto: seytar/psx
 public function write(CacheItemInterface $item)
 {
     $file = $this->getFile($item->getKey());
     if ($item->hasExpiration()) {
         $ttl = $item->getExpiration()->getTimestamp();
     } else {
         $ttl = PHP_INT_MAX;
     }
     // we write the expire date in the first bits of the file and then the
     // content
     $data = pack('I*', $ttl);
     $data .= serialize($item->get());
     file_put_contents($file, $data);
 }