BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
MultiWriteBagOStuff Class Reference
Inheritance diagram for MultiWriteBagOStuff:
Collaboration diagram for MultiWriteBagOStuff:

Public Member Functions

 __construct ($params)
 
 setDebug ($debug)
 
 set ($key, $value, $exptime=0, $flags=0)
 
 delete ($key)
 
 add ($key, $value, $exptime=0)
 
 incr ($key, $value=1)
 
 decr ($key, $value=1)
 
 lock ($key, $timeout=6, $expiry=6, $rclass= '')
 
 unlock ($key)
 
 getLastError ()
 
 clearLastError ()
 
 deleteObjectsExpiringBefore ($date, $progressCallback=false)
 
 makeKey ($class, $component=null)
 
 makeGlobalKey ($class, $component=null)
 
- Public Member Functions inherited from BagOStuff
 __construct (array $params=[])
 
 setLogger (LoggerInterface $logger)
 
 setDebug ($bool)
 
 getWithSetCallback ($key, $ttl, $callback, $flags=0)
 
 get ($key, $flags=0, $oldFlags=null)
 
 set ($key, $value, $exptime=0, $flags=0)
 
 delete ($key)
 
 merge ($key, callable $callback, $exptime=0, $attempts=10, $flags=0)
 
 changeTTL ($key, $expiry=0)
 
 lock ($key, $timeout=6, $expiry=6, $rclass= '')
 
 unlock ($key)
 
 getScopedLock ($key, $timeout=6, $expiry=30, $rclass= '')
 
 deleteObjectsExpiringBefore ($date, $progressCallback=false)
 
 getMulti (array $keys, $flags=0)
 
 setMulti (array $data, $exptime=0)
 
 add ($key, $value, $exptime=0)
 
 incr ($key, $value=1)
 
 decr ($key, $value=1)
 
 incrWithInit ($key, $ttl, $value=1, $init=1)
 
 getLastError ()
 
 clearLastError ()
 
 addBusyCallback (callable $workCallback)
 
 modifySimpleRelayEvent (array $event)
 
 makeKeyInternal ($keyspace, $args)
 
 makeGlobalKey ($class, $component=null)
 
 makeKey ($class, $component=null)
 
 getQoS ($flag)
 

Public Attributes

const ALL = INF
 
const UPGRADE_TTL = 3600
 
- Public Attributes inherited from BagOStuff
const ERR_NONE = 0
 
const ERR_NO_RESPONSE = 1
 
const ERR_UNREACHABLE = 2
 
const ERR_UNEXPECTED = 3
 
const READ_LATEST = 1
 
const READ_VERIFIED = 2
 
const WRITE_SYNC = 1
 
const WRITE_CACHE_ONLY = 2
 
- Public Attributes inherited from IExpiringStore
const TTL_SECOND = 1
 
const TTL_MINUTE = 60
 
const TTL_HOUR = 3600
 
const TTL_DAY = 86400
 
const TTL_WEEK = 604800
 
const TTL_MONTH = 2592000
 
const TTL_YEAR = 31536000
 
const TTL_PROC_SHORT = 3
 
const TTL_PROC_LONG = 30
 
const TTL_INDEFINITE = 0
 
const ATTR_EMULATION = 1
 
const QOS_EMULATION_SQL = 1
 
const ATTR_SYNCWRITES = 2
 
const QOS_SYNCWRITES_NONE = 1
 
const QOS_SYNCWRITES_BE = 2
 
const QOS_SYNCWRITES_QC = 3
 
const QOS_SYNCWRITES_SS = 4
 
const QOS_UNKNOWN = INF
 

Protected Member Functions

 doGet ($key, $flags=0)
 
 doWrite ($count, $asyncWrites, $method)
 
- Protected Member Functions inherited from BagOStuff
 doGet ($key, $flags=0)
 
 getWithToken ($key, &$casToken, $flags=0)
 
 mergeViaCas ($key, $callback, $exptime=0, $attempts=10)
 
 cas ($casToken, $key, $value, $exptime=0)
 
 mergeViaLock ($key, $callback, $exptime=0, $attempts=10, $flags=0)
 
 setLastError ($err)
 
 debug ($text)
 
 convertExpiry ($exptime)
 
 convertToRelative ($exptime)
 
 isInteger ($value)
 
 mergeFlagMaps (array $bags)
 

Protected Attributes

 $caches
 
 $asyncWrites = false
 
- Protected Attributes inherited from BagOStuff
 $locks = []
 
 $lastError = self::ERR_NONE
 
 $keyspace = 'local'
 
 $logger
 
 $asyncHandler
 
 $syncTimeout
 
 $busyCallbacks = []
 
 $attrMap = []
 

Detailed Description

A cache class that replicates all writes to multiple child caches. Reads are implemented by reading from the caches in the order they are given in the configuration until a cache gives a positive result.

Constructor & Destructor Documentation

MultiWriteBagOStuff::__construct (   $params)

$params include:

  • caches: A numbered array of either ObjectFactory::getObjectFromSpec arrays yeilding BagOStuff objects or direct BagOStuff objects. If using the former, the 'args' field must be set. The first cache is the primary one, being the first to be read in the fallback chain. Writes happen to all stores in the order they are defined. However, lock()/unlock() calls only use the primary store.
  • replication: Either 'sync' or 'async'. This controls whether writes to secondary stores are deferred when possible. Async writes require setting 'asyncHandler'. HHVM register_postsend_function() function. Async writes can increase the chance of some race conditions or cause keys to expire seconds later than expected. It is safe to use for modules when cached values: are immutable, invalidation uses logical TTLs, invalidation uses etag/timestamp validation against the DB, or merge() is used to handle races.
    Parameters
    array$params
    Exceptions
    InvalidArgumentException

Member Function Documentation

MultiWriteBagOStuff::deleteObjectsExpiringBefore (   $date,
  $progressCallback = false 
)

Delete objects expiring before a certain date.

Succeed if any of the child caches succeed.

Parameters
string$date
bool | callable$progressCallback
Returns
bool
MultiWriteBagOStuff::doWrite (   $count,
  $asyncWrites,
  $method 
)
protected

Apply a write method to the first $count backing caches

Parameters
int$count
bool$asyncWrites
string$method
mixed$args,...
Returns
bool

Member Data Documentation

const MultiWriteBagOStuff::ALL = INF

Idiom for "write to all backends"


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