[ Index ] |
|
Code source de Joomla 1.0.13 |
[Code source] [Imprimer] [Statistiques]
Fast, light and safe Cache Class
Author: | Fabien MARTY <fab@php.net> |
Version: | $Id: Lite.php 3315 2006-04-26 19:43:05Z stingrey $ |
Poids: | 609 lignes (15 kb) |
Inclus ou requis: | 1 fois |
Référencé: | 1 fois |
Nécessite: | 0 fichiers |
Cache_Lite:: (17 méthodes):
Cache_Lite()
get()
save()
remove()
clean()
setToDebug()
setLifeTime()
saveMemoryCachingState()
getMemoryCachingState()
lastModified()
raiseError()
_memoryCacheAdd()
_setFileName()
_read()
_write()
_writeAndControl()
_hash()
Classe: Cache_Lite - X-Ref
Cache_Lite($options = array(NULL) X-Ref |
Constructor $options is an assoc. Available options are : $options = array( 'cacheDir' => directory where to put the cache files (string), 'caching' => enable / disable caching (boolean), 'lifeTime' => cache lifetime in seconds (int), 'fileLocking' => enable / disable fileLocking (boolean), 'writeControl' => enable / disable write control (boolean), 'readControl' => enable / disable read control (boolean), 'readControlType' => type of read control 'crc32', 'md5', 'strlen' (string), 'pearErrorMode' => pear error mode (when raiseError is called) (cf PEAR doc) (int), 'memoryCaching' => enable / disable memory caching (boolean), 'onlyMemoryCaching' => enable / disable only memory caching (boolean), 'memoryCachingLimit' => max nbr of records to store into memory caching (int), 'fileNameProtection' => enable / disable automatic file name protection (boolean), 'automaticSerialization' => enable / disable automatic serialization (boolean) ); param: array $options options |
get($id, $group = 'default', $doNotTestCacheValidity = false) X-Ref |
Test if a cache is available and (if yes) return it param: string $id cache id param: string $group name of the cache group param: boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested return: string data of the cache (or false if no cache available) |
save($data, $id = NULL, $group = 'default') X-Ref |
Save some data in a cache file param: string $data data to put in cache (can be another type than strings if automaticSerialization is on) param: string $id cache id param: string $group name of the cache group return: boolean true if no problem |
remove($id, $group = 'default') X-Ref |
Remove a cache file param: string $id cache id param: string $group name of the cache group return: boolean true if no problem |
clean($group = false) X-Ref |
Clean the cache if no group is specified all cache files will be destroyed else only cache files of the specified group will be destroyed param: string $group name of the cache group return: boolean true if no problem |
setToDebug() X-Ref |
Set to debug mode When an error is found, the script will stop and the message will be displayed (in debug mode only). |
setLifeTime($newLifeTime) X-Ref |
Set a new life time param: int $newLifeTime new life time (in seconds) |
saveMemoryCachingState($id, $group = 'default') X-Ref |
getMemoryCachingState($id, $group = 'default', $doNotTestCacheValidity = false) X-Ref |
lastModified() X-Ref |
Return the cache last modification time BE CAREFUL : THIS METHOD IS FOR HACKING ONLY ! return: int last modification time |
raiseError($msg, $code) X-Ref |
Trigger a PEAR error To improve performances, the PEAR.php file is included dynamically. The file is so included only when an error is triggered. So, in most cases, the file isn't included and perfs are much better. param: string $msg error message param: int $code error code |
_memoryCacheAdd($id, $data) X-Ref |
_setFileName($id, $group) X-Ref |
Make a file name (with path) param: string $id cache id param: string $group name of the group |
_read() X-Ref |
Read the cache file and return the content return: string content of the cache file |
_write($data) X-Ref |
Write the given data in the cache file param: string $data data to put in cache return: boolean true if ok |
_writeAndControl($data) X-Ref |
Write the given data in the cache file and control it just after to avoir corrupted cache entries param: string $data data to put in cache return: boolean true if the test is ok |
_hash($data, $controlType) X-Ref |
Make a control key with the string containing datas param: string $data data param: string $controlType type of control 'md5', 'crc32' or 'strlen' return: string control key |
Généré le : Wed Nov 21 14:43:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |