MediaWiki  1.23.14
HashBagOStuff Class Reference

This is a test of the interface, mainly. More...

Inheritance diagram for HashBagOStuff:
Collaboration diagram for HashBagOStuff:

Public Member Functions

 __construct ()
 
 cas ( $casToken, $key, $value, $exptime=0)
 
 delete ( $key, $time=0)
 
 get ( $key, &$casToken=null)
 
 set ( $key, $value, $exptime=0)
 
- Public Member Functions inherited from BagOStuff
 add ( $key, $value, $exptime=0)
 
 clearLastError ()
 Clear the "last error" registry. More...
 
 debug ( $text)
 
 decr ( $key, $value=1)
 Decrease stored value of $key by $value while preserving its TTL. More...
 
 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...
 
 incr ( $key, $value=1)
 Increase stored value of $key by $value while preserving its TTL. More...
 
 lock ( $key, $timeout=6)
 
 merge ( $key, closure $callback, $exptime=0, $attempts=10)
 Merge changes into the existing cache value (possibly creating a new one). More...
 
 replace ( $key, $value, $exptime=0)
 
 setDebug ( $bool)
 
 unlock ( $key)
 

Public Attributes

 $bag
 
- 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

 expire ( $key)
 
- 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...
 

Additional Inherited Members

- Protected Attributes inherited from BagOStuff
 $lastError = self::ERR_NONE
 

Detailed Description

This is a test of the interface, mainly.

It stores things in an associative array, which is not going to persist between program runs.

Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 30 of file HashBagOStuff.php.

Constructor & Destructor Documentation

◆ __construct()

HashBagOStuff::__construct ( )

Definition at line 33 of file HashBagOStuff.php.

References array().

Member Function Documentation

◆ cas()

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

Reimplemented from BagOStuff.

Definition at line 90 of file HashBagOStuff.php.

References $value.

◆ delete()

HashBagOStuff::delete (   $key,
  $time = 0 
)
Parameters
$keystring
$timeint
Returns
bool

Reimplemented from BagOStuff.

Definition at line 103 of file HashBagOStuff.php.

◆ expire()

HashBagOStuff::expire (   $key)
protected
Parameters
$keystring
Returns
bool

Definition at line 41 of file HashBagOStuff.php.

Referenced by get().

◆ get()

HashBagOStuff::get (   $key,
$casToken = null 
)
Parameters
$keystring
$casToken[optional]mixed
Returns
bool|mixed

Reimplemented from BagOStuff.

Definition at line 58 of file HashBagOStuff.php.

References expire().

◆ set()

HashBagOStuff::set (   $key,
  $value,
  $exptime = 0 
)
Parameters
$keystring
$valuemixed
$exptimeint
Returns
bool

Reimplemented from BagOStuff.

Definition at line 78 of file HashBagOStuff.php.

References $value, array(), and BagOStuff\convertExpiry().

Member Data Documentation

◆ $bag

HashBagOStuff::$bag

Definition at line 31 of file HashBagOStuff.php.


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