symfony API

sfFunctionCache Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

Packages

You are currently browsing the symfony API for the 1.4 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

This class can be used to cache the result and output of any PHP callable (function and method calls).

Method Summary

  • mixed call($callable, $arguments)
    Calls a cacheable function or method (or not if there is already a cache for it).
  • string computeCacheKey($callable, $arguments)
    Computes the cache key for a given callable and the arguments.
  • sfCache getCache()
    Returns the cache instance.
  • __construct($cache)
    Constructor.

Method Details

  • (mixed) call ($callable, $arguments)

    $callable A PHP callable
    $arguments An array of arguments to pass to the callable

    Calls a cacheable function or method (or not if there is already a cache for it).


    Arguments of this method are read with func_get_args. So it doesn't appear in the function definition.

    The first argument can be any PHP callable:

    $cache->call('functionName', array($arg1, $arg2));
    $cache->call(array($object, 'methodName'), array($arg1, $arg2));

    returns The result of the function/method

  • (string) computeCacheKey ($callable, $arguments)

    $callable A PHP callable
    $arguments An array of arguments to pass to the callable

    Computes the cache key for a given callable and the arguments.

    returns The associated cache key

  • (sfCache) getCache ()

    Returns the cache instance.

    returns The sfCache instance

  • __construct ($cache)

    $cache An sfCache object instance

    Constructor.