XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Public Attributes | List of all members
CacheHandler Class Reference
Inheritance diagram for CacheHandler:
Handler

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
 

Detailed Description

CacheHandler

Author
NAVER (devel.nosp@m.oper.nosp@m.@xpre.nosp@m.ssen.nosp@m.gine..nosp@m.com)

Definition at line 9 of file CacheHandler.class.php.

Constructor & Destructor Documentation

CacheHandler::__construct (   $target,
  $info = null,
  $always_use_file = false 
)

Constructor.

Do not use this directly. You can use getInstance() instead.

See Also
CacheHandler::getInstance
Parameters
string$targettype of cache (object|template)
object$infoinfo. of DB
boolean$always_use_fileIf set true, use a file cache always
Returns
CacheHandler

Definition at line 52 of file CacheHandler.class.php.

Member Function Documentation

CacheHandler::delete (   $key)

Delete Cache

Parameters
string$keyCache key
Returns
void

Definition at line 193 of file CacheHandler.class.php.

CacheHandler::get (   $key,
  $modified_time = 0 
)

Get cached data

Parameters
string$keyCache key
int$modified_timeUnix time of data modified. If stored time is older then modified time, return false.
Returns
false|mixed Return false on failure or older then modified time. Return the string associated with the $key on success.

Definition at line 153 of file CacheHandler.class.php.

CacheHandler::getCacheKey (   $key)

Get cache name by key

Parameters
string$keyThe key that will be associated with the item.
Returns
string Returns cache name

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.

Parameters
string$keyGroupNameGroup name
string$keyCache key
Returns
string

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)

Parameters
string$targettype of cache (object|template)
object$infoinfo. of DB
boolean$always_use_fileIf set true, use a file cache always
Returns
CacheHandler

Definition at line 31 of file CacheHandler.class.php.

CacheHandler::invalidateGroupKey (   $keyGroupName)

Make invalid group key (like delete group key)

Parameters
string$keyGroupNameGroup name
Returns
void

Definition at line 273 of file CacheHandler.class.php.

CacheHandler::isSupport ( )

Return whether support or not support cache

Returns
boolean

Definition at line 122 of file CacheHandler.class.php.

CacheHandler::isValid (   $key,
  $modified_time = 0 
)

Return whether cache is valid or invalid

Parameters
string$keyCache key
int$modified_timeUnix time of data modified. If stored time is older then modified time, the data is invalid.
Returns
bool Return true on valid or false on invalid.

Definition at line 213 of file CacheHandler.class.php.

CacheHandler::put (   $key,
  $obj,
  $valid_time = 0 
)

Put data into cache

Parameters
string$keyCache key
mixed$objValue of a variable to store. $value supports all data types except resources, such as file handlers.
int$valid_timeTime 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.
Returns
bool|void Returns true on success or false on failure. If use CacheFile, returns void.

Definition at line 175 of file CacheHandler.class.php.

CacheHandler::truncate ( )

Truncate all cache

Returns
bool|void Returns true on success or false on failure. If use CacheFile, returns void.

Definition at line 230 of file CacheHandler.class.php.

Member Data Documentation

CacheHandler::$handler = null

Definition at line 15 of file CacheHandler.class.php.

CacheHandler::$keyGroupVersions = null

Definition at line 21 of file CacheHandler.class.php.


The documentation for this class was generated from the following file: