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

Public Member Functions

 getInstance ($url)
 
 __construct ($url)
 
 isSupport ()
 
 getKey ($key)
 
 put ($key, $buff, $valid_time=0)
 
 isValid ($key, $modified_time=0)
 
 get ($key, $modified_time=0)
 
 delete ($key)
 
 _delete ($_key)
 
 truncate ()
 
- Public Member Functions inherited from CacheBase
 get ($key, $modified_time=0)
 
 put ($key, $obj, $valid_time=0)
 
 isValid ($key, $modified_time=0)
 
 isSupport ()
 
 truncate ()
 

Public Attributes

 $Memcache
 
 $SelectedExtension
 
- Public Attributes inherited from CacheBase
 $valid_time = 36000
 

Detailed Description

Cache class for memcache

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

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

Constructor & Destructor Documentation

CacheMemcache::__construct (   $url)

Construct

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

Parameters
string$urlurl of memcache
Returns
void

Definition at line 40 of file CacheMemcache.class.php.

Member Function Documentation

CacheMemcache::_delete (   $_key)

Delete item from the server(private)

See Also
CacheMemcache::delete()
Parameters
string$_keyThe key associated with the item to delete.
Returns
void

Definition at line 214 of file CacheMemcache.class.php.

CacheMemcache::delete (   $key)

Delete item from the server

CacheMemcache::delete() deletes an item with tey $key.

Parameters
string$keyThe key associated with the item to delete.
Returns
void

Definition at line 201 of file CacheMemcache.class.php.

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

Retrieve item from the server

CacheMemcache::get() returns previously stored data if an item with such $key exists on the server at this moment.

Parameters
string$keyThe key to fetch
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 173 of file CacheMemcache.class.php.

CacheMemcache::getInstance (   $url)

Get instance of CacheMemcache

Parameters
string$urlurl of memcache
Returns
CacheMemcache instance of CacheMemcache

Definition at line 24 of file CacheMemcache.class.php.

CacheMemcache::getKey (   $key)

Get unique key of given key by path of XE

Parameters
string$keyCache key
Returns
string Return unique key

Definition at line 97 of file CacheMemcache.class.php.

CacheMemcache::isSupport ( )

Return whether support or not support cache

Returns
bool Return true on support or false on not support

Definition at line 71 of file CacheMemcache.class.php.

CacheMemcache::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 143 of file CacheMemcache.class.php.

CacheMemcache::put (   $key,
  $buff,
  $valid_time = 0 
)

Store data at the server

CacheMemcache::put() stores an item $buff with $key on the memcached server. Parameter $valid_time is expiration time in seconds. If it's 0, the item never expires (but memcached server doesn't guarantee this item to be stored all the time, it could be delete from the cache to make place for other items).

Remember that resource variables (i.e. file and connection descriptors) cannot be stored in the cache, because they can not be adequately represented in serialized state.

Parameters
string$keyThe key that will be associated with the item.
mixed$buffThe variable to store. Strings and integers are stored as is, other types are stored serialized.
int$valid_timeExpiration time of the item. You can also use Unix timestamp or a number of seconds starting from current time, but in the latter case the number of seconds may not exceed 2592000 (30 days). If it's equal to zero, use the default valid time CacheMemcache::valid_time.
Returns
bool Returns true on success or false on failure.

Definition at line 119 of file CacheMemcache.class.php.

CacheMemcache::truncate ( )

Flush all existing items at the server

CacheMemcache::truncate() immediately invalidates all existing items. CacheMemcache::truncate() doesn't actually free any resources, it only marks all the items as expired, so occupied memory will be overwitten by new items.

Returns
bool Returns true on success or false on failure.

Definition at line 228 of file CacheMemcache.class.php.

Member Data Documentation

CacheMemcache::$Memcache

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

CacheMemcache::$SelectedExtension

Definition at line 16 of file CacheMemcache.class.php.


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