symfony API

sfCache 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:

sfCache is an abstract class for all cache classes in symfony.

Inheritence

sfFileCache, sfSQLiteCache  <  sfCache

Method Summary

  • setLifeTime($newLifeTime)
    Sets a new life time.
  • string get($id, $namespace = self::DEFAULT_NAMESPACE, $doNotTestCacheValidity = false)
    Gets the cache content for a given id and namespace.
  • int getLifeTime()
    Returns the current life time.
  • boolean remove($id, $namespace = self::DEFAULT_NAMESPACE)
    Removes a content 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.
  • int lastModified($id, $namespace = self::DEFAULT_NAMESPACE)
    Returns the cache last modification time.
  • boolean has($id, $namespace = self::DEFAULT_NAMESPACE, $doNotTestCacheValidity = false)
    Returns true if there is a cache for the given id and namespace.

Method Details

  • setLifeTime ($newLifeTime)

    $newLifeTime The new life time (in seconds)

    Sets a new life time.

  • (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

    Gets the cache content for a given id and namespace.

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

  • (int) getLifeTime ()

    Returns the current life time.

    returns The current life time (in seconds)

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

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

    Removes a content 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 content will be destroyed else only cache contents of the specified namespace will be destroyed.

    returns true if no problem

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

    Returns the cache last modification time.

    returns The last modification time

  • (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