Exemplo n.º 1
0
Arquivo: Sql.php Projeto: 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));
 }
Exemplo 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);
 }
Exemplo n.º 3
0
Arquivo: File.php Projeto: 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);
 }
Exemplo n.º 4
0
 public function write(CacheItemInterface $item)
 {
     $this->_container[$item->getKey()] = $item;
 }