Go to the documentation of this file.
58 $this->debugMode = $bool;
70 abstract public function get( $key, &$casToken = null );
79 abstract public function set( $key,
$value, $exptime = 0 );
89 abstract public function cas( $casToken, $key,
$value, $exptime = 0 );
97 abstract public function delete( $key,
$time = 0 );
110 public function merge( $key, closure $callback, $exptime = 0, $attempts = 10 ) {
111 return $this->
mergeViaCas( $key, $callback, $exptime, $attempts );
123 protected function mergeViaCas( $key, closure $callback, $exptime = 0, $attempts = 10 ) {
126 $currentValue = $this->
get( $key, $casToken );
127 $value = $callback( $this, $key, $currentValue );
131 } elseif ( $currentValue ===
false ) {
138 }
while ( !
$success && --$attempts );
152 protected function mergeViaLock( $key, closure $callback, $exptime = 0, $attempts = 10 ) {
153 if ( !$this->
lock( $key, 6 ) ) {
157 $currentValue = $this->
get( $key );
158 $value = $callback( $this, $key, $currentValue );
166 if ( !$this->
unlock( $key ) ) {
168 trigger_error(
"Could not release lock for key '$key'." );
179 public function lock( $key, $timeout = 6 ) {
182 if ( $this->
add(
"{$key}:lock", 1, $timeout ) ) {
188 $uRTT = ceil( 1e6 * ( microtime(
true ) -
$timestamp ) );
194 if ( ++$attempts >= 3 &&
$sleep <= 1e6 ) {
201 $locked = $this->
add(
"{$key}:lock", 1, $timeout );
205 }
while ( !$locked );
215 return $this->
delete(
"{$key}:lock" );
242 $val = $this->
get( $key );
243 if ( $val !==
false ) {
257 if ( $this->
get( $key ) ===
false ) {
258 return $this->
set( $key,
$value, $exptime );
272 if ( $this->
get( $key ) !==
false ) {
273 return $this->
set( $key,
$value, $exptime );
285 if ( !$this->
lock( $key ) ) {
288 $n = $this->
get( $key );
291 $this->
set( $key, max( 0,
$n ) );
333 $this->lastError = $err;
340 if ( $this->debugMode ) {
341 $class = get_class( $this );
342 wfDebug(
"$class debug: $text\n" );
352 if ( ( $exptime != 0 ) && ( $exptime < 86400 * 3650 ) ) {
353 return time() + $exptime;
367 if ( $exptime >= 86400 * 3650 ) {
369 if ( $exptime <= 0 ) {
isInteger( $value)
Check if a value is an integer.
add( $key, $value, $exptime=0)
see documentation in includes Linker php for Linker::makeImageLink & $time
decr( $key, $value=1)
Decrease stored value of $key by $value while preserving its TTL.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
getLastError()
Get the "last error" registered; clearLastError() should be called manually.
deleteObjectsExpiringBefore( $date, $progressCallback=false)
Delete all objects expiring before a certain date.
convertExpiry( $exptime)
Convert an optionally relative time to an absolute time.
replace( $key, $value, $exptime=0)
interface is intended to be more or less compatible with the PHP memcached client.
const ERR_NONE
Possible values for getLastError()
clearLastError()
Clear the "last error" registry.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
merge( $key, closure $callback, $exptime=0, $attempts=10)
Merge changes into the existing cache value (possibly creating a new one).
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
incr( $key, $value=1)
Increase stored value of $key by $value while preserving its TTL.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getMulti(array $keys)
Get an associative array containing the item for each of the keys that have items.
cas( $casToken, $key, $value, $exptime=0)
Check and set an item.
mergeViaLock( $key, closure $callback, $exptime=0, $attempts=10)
mergeViaCas( $key, closure $callback, $exptime=0, $attempts=10)
setLastError( $err)
Set the "last error" registry.
convertToRelative( $exptime)
Convert an optionally absolute expiry time to a relative time.