MediaWiki  1.23.3
XCacheBagOStuff Class Reference

Wrapper for XCache object caching functions; identical interface to the APC wrapper. More...

Inheritance diagram for XCacheBagOStuff:
Collaboration diagram for XCacheBagOStuff:

Public Member Functions

 cas ( $casToken, $key, $value, $exptime=0)
 
 decr ( $key, $value=1)
 Decrease stored value of $key by $value while preserving its TTL. More...
 
 delete ( $key, $time=0)
 Remove a value from the XCache object cache. More...
 
 get ( $key, &$casToken=null)
 Get a value from the XCache object cache. More...
 
 incr ( $key, $value=1)
 Increase stored value of $key by $value while preserving its TTL. More...
 
 merge ( $key, closure $callback, $exptime=0, $attempts=10)
 Merge an item. More...
 
 set ( $key, $value, $expire=0)
 Store a value in the XCache object cache. More...
 
- Public Member Functions inherited from BagOStuff
 add ( $key, $value, $exptime=0)
 
 clearLastError ()
 Clear the "last error" registry. More...
 
 debug ( $text)
 
 deleteObjectsExpiringBefore ( $date, $progressCallback=false)
 Delete all objects expiring before a certain date. More...
 
 getLastError ()
 Get the "last error" registered; clearLastError() should be called manually. More...
 
 getMulti (array $keys)
 Get an associative array containing the item for each of the keys that have items. More...
 
 lock ( $key, $timeout=6)
 
 replace ( $key, $value, $exptime=0)
 
 setDebug ( $bool)
 
 unlock ( $key)
 

Additional Inherited Members

- Public Attributes inherited from BagOStuff
const ERR_NO_RESPONSE = 1
 
const ERR_NONE = 0
 Possible values for getLastError() More...
 
const ERR_UNEXPECTED = 3
 
const ERR_UNREACHABLE = 2
 
- Protected Member Functions inherited from BagOStuff
 convertExpiry ( $exptime)
 Convert an optionally relative time to an absolute time. More...
 
 convertToRelative ( $exptime)
 Convert an optionally absolute expiry time to a relative time. More...
 
 isInteger ( $value)
 Check if a value is an integer. More...
 
 mergeViaCas ( $key, closure $callback, $exptime=0, $attempts=10)
 
 mergeViaLock ( $key, closure $callback, $exptime=0, $attempts=10)
 
 setLastError ( $err)
 Set the "last error" registry. More...
 
- Protected Attributes inherited from BagOStuff
 $lastError = self::ERR_NONE
 

Detailed Description

Wrapper for XCache object caching functions; identical interface to the APC wrapper.

Definition at line 30 of file XCacheBagOStuff.php.

Member Function Documentation

◆ cas()

XCacheBagOStuff::cas (   $casToken,
  $key,
  $value,
  $exptime = 0 
)
Parameters
$casTokenmixed
$keystring
$valuemixed
$exptimeint
Returns
bool

Reimplemented from BagOStuff.

Definition at line 78 of file XCacheBagOStuff.php.

◆ decr()

XCacheBagOStuff::decr (   $key,
  $value = 1 
)

Decrease stored value of $key by $value while preserving its TTL.

Parameters
$keyString
$valueInteger
Returns
integer

Reimplemented from BagOStuff.

Definition at line 114 of file XCacheBagOStuff.php.

References $value.

◆ delete()

XCacheBagOStuff::delete (   $key,
  $time = 0 
)

Remove a value from the XCache object cache.

Parameters
string$keycache key
int$timenot used in this implementation
Returns
bool

Reimplemented from BagOStuff.

Definition at line 90 of file XCacheBagOStuff.php.

◆ get()

XCacheBagOStuff::get (   $key,
$casToken = null 
)

Get a value from the XCache object cache.

Parameters
string$keycache key
$casTokenmixed: cas token
Returns
mixed

Reimplemented from BagOStuff.

Definition at line 38 of file XCacheBagOStuff.php.

References BagOStuff\isInteger().

◆ incr()

XCacheBagOStuff::incr (   $key,
  $value = 1 
)

Increase stored value of $key by $value while preserving its TTL.

Parameters
string$keyKey to increase
$valueInteger: Value to add to $key (Default 1)
Returns
integer|bool New value or false on failure

Reimplemented from BagOStuff.

Definition at line 110 of file XCacheBagOStuff.php.

References $value.

◆ merge()

XCacheBagOStuff::merge (   $key,
closure  $callback,
  $exptime = 0,
  $attempts = 10 
)

Merge an item.

XCache does not seem to support any way of performing CAS - this however will provide a way to perform CAS-like functionality.

Parameters
$keystring
$callbackclosure Callback method to be executed
int$exptimeEither an interval in seconds or a unix timestamp for expiry
int$attemptsThe amount of times to attempt a merge in case of failure
Returns
bool success

Reimplemented from BagOStuff.

Definition at line 106 of file XCacheBagOStuff.php.

References BagOStuff\mergeViaLock().

◆ set()

XCacheBagOStuff::set (   $key,
  $value,
  $expire = 0 
)

Store a value in the XCache object cache.

Parameters
string$keycache key
$valueMixed: object to store
int$expireexpiration time
Returns
bool

Reimplemented from BagOStuff.

Definition at line 62 of file XCacheBagOStuff.php.

References $value, and BagOStuff\isInteger().


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