MediaWiki  REL1_22
DBABagOStuff Class Reference

Cache that uses DBA as a backend. More...

Inheritance diagram for DBABagOStuff:
Collaboration diagram for DBABagOStuff:

List of all members.

Public Member Functions

 __construct ($params)
 add ($key, $value, $exptime=0)
 cas ($casToken, $key, $value, $exptime=0)
 delete ($key, $time=0)
 get ($key, &$casToken=null)
 incr ($key, $step=1)
 set ($key, $value, $exptime=0)

Public Attributes

 $mDisabled
 $mFile
 $mHandler
 $mReader
 $mWriter

Protected Member Functions

 decode ($blob)
 encode ($value, $expiry)
 Encode value and expiry for storage.
 getReader ()
 getWriter ()

Detailed Description

Cache that uses DBA as a backend.

Slow due to the need to constantly open and close the file to avoid holding writer locks. Intended for development use only, as a memcached workalike for systems that don't have it.

On construction you can pass array( 'dir' => '/some/path' ); as a parameter to override the default DBA files directory (wfTempDir()).

Definition at line 35 of file DBABagOStuff.php.


Constructor & Destructor Documentation

Parameters:
$paramsarray

Definition at line 41 of file DBABagOStuff.php.

References $params, global, wfDebug(), wfTempDir(), and wfWikiID().


Member Function Documentation

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

Reimplemented from BagOStuff.

Definition at line 238 of file DBABagOStuff.php.

References $blob, $key, $ret, $value, decode(), encode(), getWriter(), list, wfProfileIn(), and wfProfileOut().

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

Reimplemented from BagOStuff.

Definition at line 181 of file DBABagOStuff.php.

References $blob, $key, $ret, $value, decode(), encode(), getWriter(), list, wfDebug(), wfProfileIn(), and wfProfileOut().

DBABagOStuff::decode ( blob) [protected]
Parameters:
$blobstring
Returns:
array list containing value first and expiry second

Definition at line 71 of file DBABagOStuff.php.

References $blob, and array().

Referenced by add(), cas(), get(), and incr().

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

Reimplemented from BagOStuff.

Definition at line 215 of file DBABagOStuff.php.

References $key, $ret, getWriter(), wfDebug(), wfProfileIn(), and wfProfileOut().

DBABagOStuff::encode ( value,
expiry 
) [protected]

Encode value and expiry for storage.

Parameters:
$value
$expiry
Returns:
string

Definition at line 60 of file DBABagOStuff.php.

References $value, and BagOStuff\convertExpiry().

Referenced by add(), cas(), incr(), and set().

DBABagOStuff::get ( key,
&$  casToken = null 
)
Parameters:
$keystring
$casToken[optional]mixed
Returns:
mixed

Reimplemented from BagOStuff.

Definition at line 117 of file DBABagOStuff.php.

References $key, decode(), getReader(), getWriter(), list, wfDebug(), wfProfileIn(), and wfProfileOut().

DBABagOStuff::getReader ( ) [protected]
Returns:
resource

Definition at line 85 of file DBABagOStuff.php.

References getWriter(), and wfDebug().

Referenced by get().

DBABagOStuff::getWriter ( ) [protected]
Returns:
resource

Definition at line 102 of file DBABagOStuff.php.

References wfDebug().

Referenced by add(), cas(), delete(), get(), getReader(), incr(), and set().

DBABagOStuff::incr ( key,
step = 1 
)
Parameters:
$keystring
$stepinteger
Returns:
integer|bool

Reimplemented from BagOStuff.

Definition at line 275 of file DBABagOStuff.php.

References $blob, $key, $ret, $value, decode(), encode(), getWriter(), list, wfDebug(), wfProfileIn(), and wfProfileOut().

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

Reimplemented from BagOStuff.

Definition at line 155 of file DBABagOStuff.php.

References $blob, $key, $ret, $value, encode(), getWriter(), wfDebug(), wfProfileIn(), and wfProfileOut().


Member Data Documentation

DBABagOStuff::$mDisabled

Definition at line 36 of file DBABagOStuff.php.

DBABagOStuff::$mFile

Definition at line 36 of file DBABagOStuff.php.

DBABagOStuff::$mHandler

Definition at line 36 of file DBABagOStuff.php.

DBABagOStuff::$mReader

Definition at line 36 of file DBABagOStuff.php.

DBABagOStuff::$mWriter

Definition at line 36 of file DBABagOStuff.php.


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