[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/cache/ -> cache.class.php (sommaire)

\defgroup Cache The Cache group is made up of the Cache class, which provides the basic methods to store and retrieve data based on keys, and the CacheManager class which provides a singleton to access to the global.

Poids: 190 lignes (6 kb)
Inclus ou requis:0 fois
Référencé: 1 fois
Nécessite: 0 fichiers

Définit 1 class

Cache:: (10 méthodes):
  Cache()
  setLifeTime()
  setData()
  setMultipleData()
  getData()
  removeData()
  clearCacheByGroup()
  clearCache()
  setCacheDir()
  getCacheStats()


Classe: Cache  - X-Ref

\ingroup Cache

<p>This class wraps around the Cache_Lite class and provides a set of basic methods for storing
and retrieving data from the cache. As of LifeType 1.1, this class is only used by the DAO layer as its
caching mechanism but it can only be used by any other class if necessary.</p>

<p>You probably don't want to create objects of this class, but instead use the CacheManager class
that provides a singleton to access one global instance of this class</p>

Cache( $cacheProperties )   X-Ref
Constructor of the class.

param: cacheProperties An array with parameters as required by Cache_Lite        

setLifeTime( $lifeTime )   X-Ref
Sets the lifetime of cached data

param: lifeType

setData( $id, $group, $data )   X-Ref
Saves data to the cache. Data is identified by an id and a group. Any data
can be saved to the cache but please check that you are using unique keys for
different data or else data will be overwritten. If you have data that you know
beforehand is not going to be unique, please use the setMultipleData method.

param: id Unique identifier for the data.
param: group The cache group
param: data Data that is going to be cached
return: Returns true if successful or false otherwise

setMultipleData( $id, $group, $data )   X-Ref
Works in the same way as Cache::setData does, but instead of setting single values,
it assumes that the value we're setting for the given key is part of an array of values. This
method is useful for data which we know is not unique, since it will store the data
identified by data in an array identified by $id, alongside with any other values
that are sharing the same key.

param: id Unique identifier for the data.
param: group The cache group
param: data Data that is going to be cached
return: Returns true if successful or false otherwise

getData( $id, $group )   X-Ref
Retrieves previously stored data given its key.

param: id Unique identifier under which the data was cached
param: group Cache group where data was stored
return: Returns the cached data if found or false otherwise

removeData( $id, $group )   X-Ref
Removes cached data from the cache, given its key and cache group.

param: id Unique identifier under which the data was cached
param: group Cache group where data was stored
return: Returns the cached data if found or false otherwise

clearCacheByGroup( $group )   X-Ref
Clears the data of a whole cache group.

param: group The group identifer whose data we'd like to cleanup
return:

clearCache()   X-Ref
Clears the entire cache, use with care.

return: Returns true if successful or false otherwise

setCacheDir( $temp_folder )   X-Ref
Sets the directory where Cache_Lite will store its data. By default this is set to
./tmp.

param: temp_folder Folder where cache data will be stored
return: Always true

getCacheStats()   X-Ref
Returns the total count of cache hits, miss and total queries over the lifetime of the
script so far.

return: An array with 3 keys: "hits", "total" and "miss"



Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics