You are here

protected function SQLite3Cache::doSave in Plug 7

Puts data into the cache.

Parameters

string $id The cache id.:

string $data The cache entry/data.:

int $lifeTime The lifetime. If != 0, sets a specific lifetime for this: cache entry (0 => infinite lifeTime).

Return value

boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise.

Overrides CacheProvider::doSave

File

lib/doctrine/cache/lib/Doctrine/Common/Cache/SQLite3Cache.php, line 107

Class

SQLite3Cache
SQLite3 cache provider.

Namespace

Doctrine\Common\Cache

Code

protected function doSave($id, $data, $lifeTime = 0) {
  $statement = $this->sqlite
    ->prepare(sprintf('INSERT OR REPLACE INTO %s (%s) VALUES (:id, :data, :expire)', $this->table, implode(',', $this
    ->getFields())));
  $statement
    ->bindValue(':id', $id);
  $statement
    ->bindValue(':data', serialize($data), SQLITE3_BLOB);
  $statement
    ->bindValue(':expire', $lifeTime > 0 ? time() + $lifeTime : null);
  return $statement
    ->execute() instanceof SQLite3Result;
}