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)); }
public function write(CacheItemInterface $item) { if ($item->hasExpiration()) { $ttl = $item->getExpiration()->getTimestamp(); } else { $ttl = 0; } $this->memcache->set($item->getKey(), $item->get(), 0, $ttl); }
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); }
public function write(CacheItemInterface $item) { $this->_container[$item->getKey()] = $item; }