symfony API

sfSQLiteCache Class

« Back to API menu

action

addon

cache

config

controller

countable

database

debug

exception

filter

generator

helper

i18n

log

request

response

storage

test

user

util

validator

view

You are currently browsing the symfony documentation for the 1.0 version. Switch to:

Cache class that stores content in a sqlite database.

Inheritence

sfSQLiteCache  <  sfCache

Method Summary

  • __construct($database = null)
    Constructor.
  • createSchema()
    Creates the database schema.
  • initialize($options = array())
    Initializes the cache.
  • string get($id, $namespace = self::DEFAULT_NAMESPACE, $doNotTestCacheValidity = false)
    Tests if a cache is available and (if yes) returns it.
  • boolean remove($id, $namespace = self::DEFAULT_NAMESPACE)
    Removes an element from the cache.
  • boolean set($id, $namespace = self::DEFAULT_NAMESPACE, $data)
    Saves some data in the cache.
  • boolean clean($namespace = null, $mode = &apos;all&apos;)
    Cleans the cache.
  • setDatabase($database)
    Sets the database name.
  • __destruct()
    Destructor.
  • string getDatabase()
    Gets the database name.
  • lastModified($id, $namespace = self::DEFAULT_NAMESPACE)
  • boolean has($id, $namespace = self::DEFAULT_NAMESPACE, $doNotTestCacheValidity = false)
    Returns true if there is a cache for the given id and namespace.

Methods inherited from sfCache

setLifeTime , get , getLifeTime , remove , set , clean , lastModified , has

Method Details

  • __construct ($database = null)

    $database The database name

    Constructor.

  • createSchema ()

    Creates the database schema.

    throws sfException

  • initialize ($options = array())

    $options An array of options Available options:
    • database: database name

    • automaticCleaningFactor: disable / tune automatic cleaning process (int)

    Initializes the cache.

  • (string) get ($id, $namespace = self::DEFAULT_NAMESPACE, $doNotTestCacheValidity = false)

    $id The cache id
    $namespace The name of the cache namespace
    $doNotTestCacheValidity If set to true, the cache validity won't be tested

    Tests if a cache is available and (if yes) returns it.

    returns The data in the cache (or null if no cache available)

  • (boolean) remove ($id, $namespace = self::DEFAULT_NAMESPACE)

    $id The cache id
    $namespace The name of the cache namespace

    Removes an element from the cache.

    returns true if no problem

  • (boolean) set ($id, $namespace = self::DEFAULT_NAMESPACE, $data)

    $id The cache id
    $namespace The name of the cache namespace
    $data The data to put in cache

    Saves some data in the cache.

    returns true if no problem

  • (boolean) clean ($namespace = null, $mode = &apos;all&apos;)

    $namespace The name of the cache namespace

    Cleans the cache.

    If no namespace is specified all cache files will be destroyed else only cache files of the specified namespace will be destroyed.

    returns true if no problem

  • setDatabase ($database)

    $database The database name where to store the cache

    Sets the database name.

  • __destruct ()

    Destructor.

  • (string) getDatabase ()

    Gets the database name.

    returns The database name

  • lastModified ($id, $namespace = self::DEFAULT_NAMESPACE)

  • (boolean) has ($id, $namespace = self::DEFAULT_NAMESPACE, $doNotTestCacheValidity = false)

    $id The cache id
    $namespace The name of the cache namespace
    $doNotTestCacheValidity If set to true, the cache validity won't be tested

    Returns true if there is a cache for the given id and namespace.

    returns true if the cache exists, false otherwise