MediaWiki  REL1_19
BagOStuff Class Reference

interface is intended to be more or less compatible with the PHP memcached client. More...

Inheritance diagram for BagOStuff:

List of all members.

Public Member Functions

 add ($key, $value, $exptime=0)
 debug ($text)
 decr ($key, $value=1)
 delete ($key, $time=0)
 Delete an item.
 deleteObjectsExpiringBefore ($date, $progressCallback=false)
 Delete all objects expiring before a certain date.
 get ($key)
 Get an item with the given key.
 incr ($key, $value=1)
 keys ()
 lock ($key, $timeout=0)
 replace ($key, $value, $exptime=0)
 set ($key, $value, $exptime=0)
 Set an item.
 setDebug ($bool)
 unlock ($key)

Protected Member Functions

 convertExpiry ($exptime)
 Convert an optionally relative time to an absolute time.

Private Attributes

 $debugMode = false

Detailed Description

interface is intended to be more or less compatible with the PHP memcached client.

backends for local hash array and SQL table included: $bag = new HashBagOStuff(); $bag = new SqlBagOStuff(); # connect to db first

Definition at line 43 of file BagOStuff.php.


Member Function Documentation

BagOStuff::add ( key,
value,
exptime = 0 
)

Reimplemented in DBABagOStuff, MemcachedPhpBagOStuff, and MultiWriteBagOStuff.

Definition at line 110 of file BagOStuff.php.

BagOStuff::convertExpiry ( exptime) [protected]

Convert an optionally relative time to an absolute time.

Definition at line 159 of file BagOStuff.php.

Referenced by DBABagOStuff\encode(), HashBagOStuff\set(), and EhcacheBagOStuff\set().

Here is the caller graph for this function:

BagOStuff::debug ( text)

Definition at line 149 of file BagOStuff.php.

References wfDebug().

Referenced by SqlBagOStuff\get().

Here is the call graph for this function:

Here is the caller graph for this function:

BagOStuff::decr ( key,
value = 1 
)

Reimplemented in MemcachedPhpBagOStuff, and MultiWriteBagOStuff.

Definition at line 145 of file BagOStuff.php.

References incr().

Here is the call graph for this function:

BagOStuff::delete ( key,
time = 0 
) [abstract]

Delete an item.

Parameters:
$keystring
$timeint Amount of time to delay the operation (mostly memcached-specific)

Reimplemented in SqlBagOStuff, DBABagOStuff, EhcacheBagOStuff, MemcachedPhpBagOStuff, WinCacheBagOStuff, MultiWriteBagOStuff, XCacheBagOStuff, HashBagOStuff, APCBagOStuff, and EmptyBagOStuff.

BagOStuff::deleteObjectsExpiringBefore ( date,
progressCallback = false 
)

Delete all objects expiring before a certain date.

Parameters:
$dateThe reference date in MW format
$progressCallbackOptional, a function which will be called regularly during long-running operations with the percentage progress as the first parameter.
Returns:
true on success, false if unimplemented

Reimplemented in SqlBagOStuff, and MultiWriteBagOStuff.

Definition at line 103 of file BagOStuff.php.

BagOStuff::get ( key) [abstract]

Get an item with the given key.

Returns false if it does not exist.

Parameters:
$keystring
Returns:
bool|Object

Reimplemented in SqlBagOStuff, DBABagOStuff, MemcachedPhpBagOStuff, EhcacheBagOStuff, MultiWriteBagOStuff, HashBagOStuff, WinCacheBagOStuff, XCacheBagOStuff, APCBagOStuff, and EmptyBagOStuff.

BagOStuff::incr ( key,
value = 1 
)
Parameters:
$keyString: Key to increase
$valueInteger: Value to add to $key (Default 1)
Returns:
null if lock is not possible else $key value increased by $value

Reimplemented in SqlBagOStuff, MemcachedPhpBagOStuff, and MultiWriteBagOStuff.

Definition at line 129 of file BagOStuff.php.

References $n, lock(), and unlock().

Referenced by decr().

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented in SqlBagOStuff, DBABagOStuff, WinCacheBagOStuff, HashBagOStuff, and APCBagOStuff.

Definition at line 89 of file BagOStuff.php.

BagOStuff::lock ( key,
timeout = 0 
)

Reimplemented in MemcachedPhpBagOStuff, and MultiWriteBagOStuff.

Definition at line 79 of file BagOStuff.php.

Referenced by incr().

Here is the caller graph for this function:

BagOStuff::replace ( key,
value,
exptime = 0 
)

Reimplemented in MemcachedPhpBagOStuff, and MultiWriteBagOStuff.

Definition at line 118 of file BagOStuff.php.

BagOStuff::set ( key,
value,
exptime = 0 
) [abstract]

Set an item.

Parameters:
$keystring
$valuemixed
$exptimeint Either an interval in seconds or a unix timestamp for expiry

Reimplemented in SqlBagOStuff, DBABagOStuff, EhcacheBagOStuff, MemcachedPhpBagOStuff, MultiWriteBagOStuff, HashBagOStuff, WinCacheBagOStuff, XCacheBagOStuff, APCBagOStuff, and EmptyBagOStuff.

BagOStuff::setDebug ( bool)
Parameters:
$boolbool

Reimplemented in MemcachedPhpBagOStuff, and MultiWriteBagOStuff.

Definition at line 49 of file BagOStuff.php.

BagOStuff::unlock ( key)

Reimplemented in MemcachedPhpBagOStuff, and MultiWriteBagOStuff.

Definition at line 84 of file BagOStuff.php.

Referenced by incr().

Here is the caller graph for this function:


Member Data Documentation

BagOStuff::$debugMode = false [private]

Definition at line 44 of file BagOStuff.php.


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