.

Cache Class Reference
[Model]

Wrapper around cache access. More...

List of all members.

Static Public Member Functions

static  clear ($cache_keys=NULL, $ignore_disabled=false)
  Clear the cache.
static  is_cached ($cache_keys, $ignore_disabled=false)
  Returns true, if item is cached.
static  read ($cache_keys, $ignore_disabled=false)
  Read from cache.
static  remove_expired ()
  Removes expired cache entries.
static  set_implementation (ICachePersister $impl)
  Set persistance implementation.
static  store ($cache_keys, $content, $cache_life_time, $data= '', $is_compressed=false, $ignore_disabled=false)
  Store content in cache.

Detailed Description

Wrapper around cache access.

Author:
Gerd Riesselmann

Definition at line 8 of file cache.facade.php.


Member Function Documentation

static Cache::clear ( cache_keys = NULL,
ignore_disabled = false  
) [static]

Clear the cache.

Parameters:
Mixed  A set of key params, may be an array or a string, or an ICachable instance. If NULL, all is cleared
$ignore_disabled  Clear item, even if cache is disabled

Definition at line 104 of file cache.facade.php.

00104                                                                                    {
00105                 // Allow diableing of cache
00106                 if (!$ignore_disabled && Config::has_feature(Config::DISABLE_CACHE)) {
00107                         return;                 
00108                 }
00109                 
00110                 if ($cache_keys instanceof ICachable) {
00111                         $keys = $cache_keys->get_all_cache_ids();
00112                         foreach($keys as $key) {
00113                                 self::do_clear($key);
00114                         }
00115                         foreach($cache_keys->get_dependend_cachables() as $dependance) {
00116                                 self::clear($dependance);
00117                         }
00118                 }
00119                 else {
00120                         self::do_clear($cache_keys);
00121                 }       
00122         }
static Cache::is_cached ( cache_keys,
ignore_disabled = false  
) [static]

Returns true, if item is cached.

Parameters:
$cache_keys  mixed A set of key params, may be an array or a string
$ignore_disabled  Lookup item, even if cache is disabled
Returns:
bool

Definition at line 45 of file cache.facade.php.

00045                                                                                 {
00046                 // Allow diableing of cache
00047                 if (!$ignore_disabled && Config::has_feature(Config::DISABLE_CACHE)) {
00048                         return false;                   
00049                 }
00050                 
00051                 $impl = self::get_implementation();
00052                 return $impl->is_cached($cache_keys);
00053         }
static Cache::read ( cache_keys,
ignore_disabled = false  
) [static]

Read from cache.

Parameters:
Mixed  A set of key params, may be an array or a string
$ignore_disabled  Lookup item, even if cache is disabled
Returns:
ICacheItem False if cache is not found

Definition at line 62 of file cache.facade.php.

00062                                                                            {
00063                 // Allow diableing of cache
00064                 if (!$ignore_disabled && Config::has_feature(Config::DISABLE_CACHE)) {
00065                         return false;                   
00066                 }
00067 
00068                 $impl = self::get_implementation();
00069                 return $impl->read($cache_keys);
00070         }
static Cache::remove_expired (  )  [static]

Removes expired cache entries.

Definition at line 135 of file cache.facade.php.

00135                                                 {
00136                 $impl = self::get_implementation();
00137                 $impl->remove_expired();
00138         }
static Cache::set_implementation ( ICachePersister impl  )  [static]

Set persistance implementation.

Parameters:
ICachePersister  $impl

Definition at line 34 of file cache.facade.php.

00034                                                                          {
00035                 self::$implementation = $impl;
00036         }
static Cache::store ( cache_keys,
content,
cache_life_time,
data = '',
is_compressed = false,
ignore_disabled = false  
) [static]

Store content in cache.

Parameters:
mixed  $cache_keys A set of key params, may be an array or a string
string  $content The cache
int  $cache_life_time Cache life time in seconds
mixed  $data Any data assoziated with this item
bool  $is_compressed True, if $content is already gzip compressed
$ignore_disabled  Store item, even if cache is disabled

Definition at line 82 of file cache.facade.php.

00082                                                                                                                                             {
00083                 // Allow diableing of cache
00084                 if (!$ignore_disabled && Config::has_feature(Config::DISABLE_CACHE)) {
00085                         return;                 
00086                 }
00087                 
00088                 try {
00089                         $impl = self::get_implementation();
00090                         $impl->store($cache_keys, $content, $cache_life_time, $data, $is_compressed);
00091                 }
00092                 catch (Exception $ex) {
00093                         // If inserting into cache fails, just resume application!
00094                         @error_log($ex->getMessage());                  
00095                 }               
00096         }

The documentation for this class was generated from the following file: