Esempio n. 1
0
File: Sql.php Progetto: seytar/psx
 public function write(CacheItemInterface $item)
 {
     $columnId = $this->allocation->get(self::COLUMN_ID);
     $columnContent = $this->allocation->get(self::COLUMN_CONTENT);
     $columnDate = $this->allocation->get(self::COLUMN_DATE);
     $this->connection->insert($this->tableName, array($columnId => $item->getKey(), $columnContent => serialize($item->get()), $columnDate => $item->hasExpiration() ? date(DateTime::SQL) : null));
 }
Esempio n. 2
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. 3
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);
 }
Esempio n. 4
0
 public function write(CacheItemInterface $item)
 {
     $this->_container[$item->getKey()] = $item;
 }