Cache
[ class tree: Cache ] [ index: Cache ] [ all elements ]

Class: Cache_Function

Source Location: /Cache-1.5.7/Cache/Function.php

Class Overview

PEAR
   |
   --Cache
      |
      --Cache_Function

Function_Cache


Author(s):

Version:

  • $Revision: 315102 $

Variables

Methods


Inherited Variables

Inherited Methods

Class: Cache

Cache::Cache()
this Constructor set the Container Property as a Cache_Container|Cache_Error Object.
Cache::extSave()
Stores a dataset with additional userdefined data.
Cache::flush()
Flushes the cache - removes all data from it
Cache::garbageCollection()
Calls the garbage collector of the storage object with a certain probability
Cache::generateID()
Generates a "unique" ID for the given value
Cache::get()
Returns the requested dataset it if exists and is not expired
Cache::getCaching()
Returns the current caching state.
Cache::getUserdata()
Returns the userdata field of a cached data set.
Cache::isCached()
Checks if a dataset exists.
Cache::isExpired()
Checks if a dataset is expired
Cache::load()
Loads the given ID from the cache.
Cache::remove()
Removes the specified dataset from the cache.
Cache::save()
Stores the given data in the cache.
Cache::setCaching()
Enables or disables caching.
Cache::_Cache()

Class Details

[line 71]
Function_Cache

Purpose:

Caching the result and output of functions.

Example:

require_once 'Cache/Function.php';

class foo { function bar($test) { echo "foo::bar($test)
"; } }

class bar { function foobar($object) { echo '$'.$object.'->foobar('.$object.')
'; } }

$bar = new bar;

function foobar() { echo 'foobar()'; }

$cache = new Cache_Function();

$cache->call('foo::bar', 'test'); $cache->call('bar->foobar', 'bar'); $cache->call('foobar');

Note:

You cannot cache every function. You should only cache functions that only depend on their arguments and don't use global or static variables, don't rely on database queries or files, and so on.



[ Top ]


Class Variables

$expires =

[line 73]


Type:   mixed


[ Top ]



Method Detail

Cache_Function (Constructor)   [line 82]

Cache_Function Cache_Function( [string $container = 'file'], [array $container_options = array('cache_dir' => '.', 'filename_prefix' => 'cache_' )], [integer $expires = 3600])

Constructor

Parameters:

string   $container     Name of container class
array   $container_options     Array with container class options
integer   $expires     Number of seconds for which to cache

[ Top ]

_Cache_Function (Destructor)   [line 97]

void _Cache_Function( )

PEAR-Deconstructor

Call deconstructor of parent


[ Top ]

call   [line 108]

mixed call( )

Calls a cacheable function or method.
  • Access: public

[ Top ]


Documentation generated on Thu, 15 Sep 2011 07:00:05 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.