프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$_automaticCleaningFactor | integer | The automatic cleaning process destroy too old (for the given life time) cache files when a new cache file is written. 0 => no automatic cache cleaning 1 => systematic cache cleaning x (integer) > 1 => automatic cleaning randomly 1 times on x cache write | |
$_automaticSerialization | boolean | it can be used to save directly datas which aren't strings (but it's slower) | |
$_cacheDir | string | Directory where to put the cache files (make sure to add a trailing slash) | |
$_caching | boolean | (can be very usefull for the debug of cached scripts) | |
$_errorHandlingAPIBreak | boolean | In CACHE_LITE_ERROR_RETURN mode, error handling was not good because for example save() method always returned a boolean (a PEAR_Error object would be better in CACHE_LITE_ERROR_RETURN mode). To correct this without breaking the API, this option (false by default) can change this handling. | |
$_file | string | File name (with path) | |
$_fileLocking | boolean | (can avoid cache corruption under bad circumstances) | |
$_fileName | string | File name (without path) | |
$_fileNameProtection | boolean | if set to true, you can use any cache id or group name if set to false, it can be faster but cache ids and group names will be used directly in cache file names so be carefull with special characters... | |
$_group | string | Current cache group | |
$_hashedDirectoryLevel | integer | Set the hashed directory structure level. 0 means "no hashed directory structure", 1 means "one level of directory", 2 means "two levels"... This option can speed up Cache_Lite only when you have many thousands of cache file. Only specific benchs can help you to choose the perfect value for you. Maybe, 1 or 2 is a good start. | |
$_hashedDirectoryUmask | integer | Umask for hashed directory structure | |
$_id | string | Current cache id | |
$_lifeTime | integer | If null, the cache is valid forever. | |
$_memoryCaching | boolean | NB : There is no lifetime for memory caching ! | |
$_memoryCachingArray | array | Memory caching array | |
$_memoryCachingCounter | integer | Memory caching counter | |
$_memoryCachingLimit | integer | Memory caching limit | |
$_onlyMemoryCaching | boolean | Enable / Disable "Only Memory Caching" (be carefull, memory caching is "beta quality") | |
$_pearErrorMode | integer | (see PEAR doc) | |
$_readControl | boolean | If enabled, a control key is embeded in cache file and this key is compared with the one calculated after the reading. | |
$_readControlType | boolean | Available values are : 'md5' for a md5 hash control (best but slowest) 'crc32' for a crc32 hash control (lightly less safe but faster, better choice) 'strlen' for a length only test (fastest) | |
$_refreshTime | integer | Timestamp of the last valid cache | |
$_writeControl | boolean | Enable write control will lightly slow the cache writing but not the cache reading Write control can detect some corrupt cache files but maybe it's not a perfect control |
메소드 | 설명 | |
---|---|---|
__construct ( array $options = [NULL] ) | Constructor | |
_cleanDir ( string $dir, string $group = false, string $mode = 'ingroup' ) : boolean | Recursive function for cleaning cache file in the given directory | |
_hash ( string $data, string $controlType ) : string | Make a control key with the string containing datas | |
_memoryCacheAdd ( string $data ) | Add some date in the memory caching array | |
_read ( ) : string | Read the cache file and return the content | |
_setFileName ( string $id, string $group ) | Make a file name (with path) | |
_setRefreshTime ( ) | Compute & set the refresh time | |
_unlink ( string $file ) : boolean | Remove a file | |
_write ( string $data ) : boolean | Write the given data in the cache file | |
_writeAndControl ( string $data ) : boolean | Write the given data in the cache file and control it just after to avoir corrupted cache entries | |
clean ( string $group = false, string $mode = 'ingroup' ) : boolean | Clean the cache | |
extendLife ( ) | Extend the life of a valid cache file | |
get ( string $id, string $group = 'default', boolean $doNotTestCacheValidity = false ) : string | Test if a cache is available and (if yes) return it | |
getMemoryCachingState ( string $id, string $group = 'default', boolean $doNotTestCacheValidity = false ) | Load the state of the caching memory array from a given cache file cache | |
lastModified ( ) : integer | Return the cache last modification time | |
raiseError ( string $msg, integer $code ) | Trigger error | |
remove ( string $id, string $group = 'default' ) : boolean | Remove a cache file | |
save ( string $data, string $id = NULL, string $group = 'default' ) : boolean | Save some data in a cache file | |
saveMemoryCachingState ( string $id, string $group = 'default' ) | Save the state of the caching memory array into a cache file cache | |
setLifeTime ( integer $newLifeTime ) | Set a new life time | |
setOption ( $name, $value ) | Generic way to set a Cache_Lite option | |
setToDebug ( ) | Set to debug mode |
public __construct ( array $options = [NULL] ) | ||
$options | array | options |
public _cleanDir ( string $dir, string $group = false, string $mode = 'ingroup' ) : boolean | ||
$dir | string | directory complete path (with a trailing slash) |
$group | string | name of the cache group |
$mode | string | flush cache mode : 'old', 'ingroup', 'notingroup', 'callback_myFunction' |
리턴 | boolean | true if no problem |
public _memoryCacheAdd ( string $data ) | ||
$data | string | data to cache |
public _setFileName ( string $id, string $group ) | ||
$id | string | cache id |
$group | string | name of the group |
public _writeAndControl ( string $data ) : boolean | ||
$data | string | data to put in cache |
리턴 | boolean | true if the test is ok (else : false or a PEAR_Error object) |
public lastModified ( ) : integer | ||
리턴 | integer | last modification time |
public raiseError ( string $msg, integer $code ) | ||
$msg | string | error message |
$code | integer | error code |
public save ( string $data, string $id = NULL, string $group = 'default' ) : boolean | ||
$data | string | data to put in cache (can be another type than strings if automaticSerialization is on) |
$id | string | cache id |
$group | string | name of the cache group |
리턴 | boolean | true if no problem (else : false or a PEAR_Error object) |
public saveMemoryCachingState ( string $id, string $group = 'default' ) | ||
$id | string | cache id |
$group | string | name of the cache group |
public setLifeTime ( integer $newLifeTime ) | ||
$newLifeTime | integer | new life time (in seconds) |
public setOption ( $name, $value ) |
public setToDebug ( ) |
public int $_automaticCleaningFactor | ||
리턴 | integer |
public bool $_automaticSerialization | ||
리턴 | boolean |
public string $_cacheDir | ||
리턴 | string |
public bool $_caching | ||
리턴 | boolean |
public bool $_errorHandlingAPIBreak | ||
리턴 | boolean |
public bool $_fileLocking | ||
리턴 | boolean |
public bool $_fileNameProtection | ||
리턴 | boolean |
public int $_hashedDirectoryLevel | ||
리턴 | integer |
public int $_hashedDirectoryUmask | ||
리턴 | integer |
public bool $_memoryCaching | ||
리턴 | boolean |
public int $_memoryCachingCounter | ||
리턴 | integer |
public bool $_onlyMemoryCaching | ||
리턴 | boolean |
public bool $_readControl | ||
리턴 | boolean |
public bool $_readControlType | ||
리턴 | boolean |
public bool $_writeControl | ||
리턴 | boolean |