Public Member Functions | |
& | getInstance ($target= 'object', $info=null, $always_use_file=false) |
__construct ($target, $info=null, $always_use_file=false) | |
isSupport () | |
getCacheKey ($key) | |
get ($key, $modified_time=0) | |
put ($key, $obj, $valid_time=0) | |
delete ($key) | |
isValid ($key, $modified_time=0) | |
truncate () | |
getGroupKey ($keyGroupName, $key) | |
invalidateGroupKey ($keyGroupName) | |
Public Attributes | |
$handler = null | |
$keyGroupVersions = null | |
Definition at line 9 of file CacheHandler.class.php.
CacheHandler::__construct | ( | $target, | |
$info = null , |
|||
$always_use_file = false |
|||
) |
Constructor.
Do not use this directly. You can use getInstance() instead.
string | $target | type of cache (object|template) |
object | $info | info. of DB |
boolean | $always_use_file | If set true, use a file cache always |
Definition at line 52 of file CacheHandler.class.php.
CacheHandler::delete | ( | $key | ) |
Delete Cache
string | $key | Cache key |
Definition at line 193 of file CacheHandler.class.php.
CacheHandler::get | ( | $key, | |
$modified_time = 0 |
|||
) |
Get cached data
string | $key | Cache key |
int | $modified_time | Unix time of data modified. If stored time is older then modified time, return false. |
Definition at line 153 of file CacheHandler.class.php.
CacheHandler::getCacheKey | ( | $key | ) |
Get cache name by key
string | $key | The key that will be associated with the item. |
Definition at line 138 of file CacheHandler.class.php.
CacheHandler::getGroupKey | ( | $keyGroupName, | |
$key | |||
) |
Function used for generating keys for similar objects.
Ex: 1:document:123 1:document:777
This allows easily removing all object of type "document" from cache by simply invalidating the group key.
The new key will be 2:document:123, thus forcing the document to be reloaded from the database.
string | $keyGroupName | Group name |
string | $key | Cache key |
Definition at line 256 of file CacheHandler.class.php.
& CacheHandler::getInstance | ( | $target = 'object' , |
|
$info = null , |
|||
$always_use_file = false |
|||
) |
Get a instance of CacheHandler(for singleton)
string | $target | type of cache (object|template) |
object | $info | info. of DB |
boolean | $always_use_file | If set true, use a file cache always |
Definition at line 31 of file CacheHandler.class.php.
CacheHandler::invalidateGroupKey | ( | $keyGroupName | ) |
Make invalid group key (like delete group key)
string | $keyGroupName | Group name |
Definition at line 273 of file CacheHandler.class.php.
CacheHandler::isSupport | ( | ) |
Return whether support or not support cache
Definition at line 122 of file CacheHandler.class.php.
CacheHandler::isValid | ( | $key, | |
$modified_time = 0 |
|||
) |
Return whether cache is valid or invalid
string | $key | Cache key |
int | $modified_time | Unix time of data modified. If stored time is older then modified time, the data is invalid. |
Definition at line 213 of file CacheHandler.class.php.
CacheHandler::put | ( | $key, | |
$obj, | |||
$valid_time = 0 |
|||
) |
Put data into cache
string | $key | Cache key |
mixed | $obj | Value of a variable to store. $value supports all data types except resources, such as file handlers. |
int | $valid_time | Time for the variable to live in the cache in seconds. After the value specified in ttl has passed the stored variable will be deleted from the cache. If no ttl is supplied, use the default valid time. |
Definition at line 175 of file CacheHandler.class.php.
CacheHandler::truncate | ( | ) |
Truncate all cache
Definition at line 230 of file CacheHandler.class.php.
CacheHandler::$handler = null |
Definition at line 15 of file CacheHandler.class.php.
CacheHandler::$keyGroupVersions = null |
Definition at line 21 of file CacheHandler.class.php.