[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/objectcache/ -> BagOStuff.php (summary)

Classes to cache objects in PHP accelerators, SQL database or DBA files Copyright © 2003-2004 Brion Vibber <[email protected]> https://www.mediawiki.org/

File Size: 406 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 20 functions

  setDebug()
  merge()
  mergeViaCas()
  mergeViaLock()
  lock()
  unlock()
  deleteObjectsExpiringBefore()
  getMulti()
  setMulti()
  add()
  incr()
  decr()
  incrWithInit()
  getLastError()
  clearLastError()
  setLastError()
  debug()
  convertExpiry()
  convertToRelative()
  isInteger()

Functions
Functions that are not part of a class:

setDebug( $bool )   X-Ref

param: bool $bool

merge( $key, Closure $callback, $exptime = 0, $attempts = 10 )   X-Ref
Merge changes into the existing cache value (possibly creating a new one).
The callback function returns the new value given the current value (possibly false),
and takes the arguments: (this BagOStuff object, cache key, current value).

param: string $key
param: Closure $callback Callback method to be executed
param: int $exptime Either an interval in seconds or a unix timestamp for expiry
param: int $attempts The amount of times to attempt a merge in case of failure
return: bool Success

mergeViaCas( $key, Closure $callback, $exptime = 0, $attempts = 10 )   X-Ref

param: string $key
param: Closure $callback Callback method to be executed
param: int $exptime Either an interval in seconds or a unix timestamp for expiry
param: int $attempts The amount of times to attempt a merge in case of failure
return: bool Success

mergeViaLock( $key, Closure $callback, $exptime = 0, $attempts = 10 )   X-Ref

param: string $key
param: Closure $callback Callback method to be executed
param: int $exptime Either an interval in seconds or a unix timestamp for expiry
param: int $attempts The amount of times to attempt a merge in case of failure
return: bool Success

lock( $key, $timeout = 6 )   X-Ref

param: string $key
param: int $timeout [optional]
return: bool Success

unlock( $key )   X-Ref

param: string $key
return: bool Success

deleteObjectsExpiringBefore( $date, $progressCallback = false )   X-Ref
Delete all objects expiring before a certain date.

param: string $date The reference date in MW format
param: callable|bool $progressCallback Optional, a function which will be called
return: bool Success, false if unimplemented

getMulti( array $keys )   X-Ref
Get an associative array containing the item for each of the keys that have items.

param: array $keys List of strings
return: array

setMulti( array $data, $exptime = 0 )   X-Ref
Batch insertion

param: array $data $key => $value assoc array
param: int $exptime Either an interval in seconds or a unix timestamp for expiry
return: bool Success

add( $key, $value, $exptime = 0 )   X-Ref

param: string $key
param: mixed $value
param: int $exptime
return: bool Success

incr( $key, $value = 1 )   X-Ref
Increase stored value of $key by $value while preserving its TTL

param: string $key Key to increase
param: int $value Value to add to $key (Default 1)
return: int|bool New value or false on failure

decr( $key, $value = 1 )   X-Ref
Decrease stored value of $key by $value while preserving its TTL

param: string $key
param: int $value
return: int

incrWithInit( $key, $ttl, $value = 1, $init = 1 )   X-Ref
Increase stored value of $key by $value while preserving its TTL

This will create the key with value $init and TTL $ttl if not present

param: string $key
param: int $ttl
param: int $value
param: int $init
return: bool

getLastError()   X-Ref
Get the "last error" registered; clearLastError() should be called manually

return: int ERR_* constant for the "last error" registry

clearLastError()   X-Ref
Clear the "last error" registry


setLastError( $err )   X-Ref
Set the "last error" registry

param: int $err ERR_* constant

debug( $text )   X-Ref

param: string $text

convertExpiry( $exptime )   X-Ref
Convert an optionally relative time to an absolute time

param: int $exptime
return: int

convertToRelative( $exptime )   X-Ref
Convert an optionally absolute expiry time to a relative time. If an
absolute time is specified which is in the past, use a short expiry time.

param: int $exptime
return: int

isInteger( $value )   X-Ref
Check if a value is an integer

param: mixed $value
return: bool



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1