Свойство | Тип | Описание | |
---|---|---|---|
$_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) | |
$_file | string | File name (with path) | |
$_fileLocking | boolean | (can avoid cache corruption under bad circumstances) | |
$_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 | |
$_id | string | Current cache id | |
$_lifeTime | integer | Cache lifetime (in seconds) | |
$_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") | |
$_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 | |
_hash ( string $data, string $controlType ) : string | Make a control key with the string containing datas | |
_memoryCacheAdd ( $id, $data ) | ||
_read ( ) : string | Read the cache file and return the content | |
_setFileName ( string $id, string $group ) | Make a file name (with path) | |
_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 avoid corrupted cache entries | |
clean ( string $group = false ) : boolean | Clean the cache | |
get ( string $id, string $group = 'default', boolean $doNotTestCacheValidity = false ) : string | Test if a cache is available and (if yes) return it | |
getCacheFile ( ) | ||
getMemoryCachingState ( $id, $group = 'default', $doNotTestCacheValidity = false ) | ||
lastModified ( ) : integer | Return the cache last modification time | |
raiseError ( string $msg, integer $code ) | Trigger a PEAR 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 ( $id, $group = 'default' ) | ||
setLifeTime ( integer $newLifeTime ) | Set a new life time |
public __construct ( array $options = [null] ) | ||
$options | array | options |
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 |
public get ( string $id, string $group = 'default', boolean $doNotTestCacheValidity = false ) : string | ||
$id | string | cache id |
$group | string | name of the cache group |
$doNotTestCacheValidity | boolean | if set to true, the cache validity won't be tested |
Результат | string | data of the cache (or false if no cache available) |
public getMemoryCachingState ( $id, $group = 'default', $doNotTestCacheValidity = false ) |
public lastModified ( ) : integer | ||
Результат | integer | last modification time |
public raiseError ( string $msg, integer $code ) | ||
$msg | string | error message |
$code | integer | error code |
public setLifeTime ( integer $newLifeTime ) | ||
$newLifeTime | integer | new life time (in seconds) |
protected bool $_automaticSerialization | ||
Результат | boolean |
protected string $_cacheDir | ||
Результат | string |
protected bool $_caching | ||
Результат | boolean |
protected bool $_fileLocking | ||
Результат | boolean |
protected bool $_fileNameProtection | ||
Результат | boolean |
protected int $_lifeTime | ||
Результат | integer |
protected bool $_memoryCaching | ||
Результат | boolean |
protected array $_memoryCachingArray | ||
Результат | array |
protected int $_memoryCachingCounter | ||
Результат | integer |
protected int $_memoryCachingLimit | ||
Результат | integer |
protected bool $_onlyMemoryCaching | ||
Результат | boolean |
protected bool $_readControl | ||
Результат | boolean |
protected bool $_readControlType | ||
Результат | boolean |
protected int $_refreshTime | ||
Результат | integer |
protected bool $_writeControl | ||
Результат | boolean |