symfony API

sfCache Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.3 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.3 version. Switch to:

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

Method Summary

  • Boolean clean($mode)
    Cleans the cache.
  • string get($key, $default)
    Gets the cache content for a given key.
  • object getBackend()
    Gets the backend object.
  • int getLastModified($key)
    Returns the last modification date of the given key.
  • integer getLifetime($lifetime)
    Computes lifetime.
  • array getMany($keys)
    Gets many keys at once.
  • mixed getOption($name, $default)
    Gets an option value.
  • int getTimeout($key)
    Returns the timeout for the given key.
  • Boolean has($key)
    Returns true if there is a cache for the given key.
  • initialize($options)
    Initializes this sfCache instance.
  • string patternToRegexp($pattern)
    Converts a pattern to a regular expression.
  • Boolean remove($key)
    Removes a content from the cache.
  • Boolean removePattern($pattern)
    Removes content from the cache that matches the given pattern.
  • Boolean set($key, $data, $lifetime)
    Saves some data in the cache.
  • setOption($name, $value)
    Sets an option value.
  • __construct()
    Class constructor.

Method Details

  • (Boolean) clean ($mode) Browse code

    $mode The clean mode sfCache::ALL: remove all keys (default) sfCache::OLD: remove all expired keys

    Cleans the cache.

    returns true if no problem

  • (string) get ($key, $default) Browse code

    $key The cache key
    $default The default value is the key does not exist or not valid anymore

    Gets the cache content for a given key.

    returns The data of the cache

  • (object) getBackend () Browse code

    Gets the backend object.

    returns The backend object

  • (int) getLastModified ($key) Browse code

    $key The cache key

    Returns the last modification date of the given key.

    returns The last modified time

  • (integer) getLifetime ($lifetime) Browse code

    $lifetime Lifetime in seconds

    Computes lifetime.

    returns Lifetime in seconds

  • (array) getMany ($keys) Browse code

    $keys An array of keys

    Gets many keys at once.

    returns An associative array of data from cache

  • (mixed) getOption ($name, $default) Browse code

    $name The option name
    $default The default value

    Gets an option value.

    returns The option value

  • (int) getTimeout ($key) Browse code

    $key The cache key

    Returns the timeout for the given key.

    returns The timeout time

  • (Boolean) has ($key) Browse code

    $key The cache key

    Returns true if there is a cache for the given key.

    returns true if the cache exists, false otherwise

  • initialize ($options) Browse code

    $options An array of options. Available options: * automatic_cleaning_factor: The automatic cleaning process destroy too old (for the given life time) (default value: 1000) cache files when a new cache file is written. 0 => no automatic cache cleaning 1 => systematic cache cleaning x (integer) > 1 => automatic cleaning randomly 1 times on x cache write * lifetime (optional): The default life time (default value: 86400)

    Initializes this sfCache instance.

    throws sfInitializationException If an error occurs while initializing this sfCache instance.

  • (string) patternToRegexp ($pattern) Browse code

    $pattern A pattern

    Converts a pattern to a regular expression.


    A pattern can use some special characters:

    - * Matches a namespace (foo:*:bar)
    - ** Matches one or more namespaces (foo:**:bar)

    returns A regular expression

  • (Boolean) remove ($key) Browse code

    $key The cache key

    Removes a content from the cache.

    returns true if no problem

  • (Boolean) removePattern ($pattern) Browse code

    $pattern The cache key pattern

    Removes content from the cache that matches the given pattern.

    returns true if no problem

  • (Boolean) set ($key, $data, $lifetime) Browse code

    $key The cache key
    $data The data to put in cache
    $lifetime The lifetime

    Saves some data in the cache.

    returns true if no problem

  • setOption ($name, $value) Browse code

    $name The option name
    $value The option value

    Sets an option value.

  • __construct () Browse code

    Class constructor.