summaryrefslogtreecommitdiff
path: root/includes/objectcache/MultiWriteBagOStuff.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/objectcache/MultiWriteBagOStuff.php')
-rw-r--r--includes/objectcache/MultiWriteBagOStuff.php29
1 files changed, 26 insertions, 3 deletions
diff --git a/includes/objectcache/MultiWriteBagOStuff.php b/includes/objectcache/MultiWriteBagOStuff.php
index e496ddd8..92afaacd 100644
--- a/includes/objectcache/MultiWriteBagOStuff.php
+++ b/includes/objectcache/MultiWriteBagOStuff.php
@@ -22,8 +22,8 @@
*/
/**
- * 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
+ * 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.
*
* @ingroup Cache
@@ -61,9 +61,10 @@ class MultiWriteBagOStuff extends BagOStuff {
/**
* @param $key string
+ * @param $casToken[optional] mixed
* @return bool|mixed
*/
- public function get( $key ) {
+ public function get( $key, &$casToken = null ) {
foreach ( $this->caches as $cache ) {
$value = $cache->get( $key );
if ( $value !== false ) {
@@ -74,6 +75,17 @@ class MultiWriteBagOStuff extends BagOStuff {
}
/**
+ * @param $casToken mixed
+ * @param $key string
+ * @param $value mixed
+ * @param $exptime int
+ * @return bool
+ */
+ public function cas( $casToken, $key, $value, $exptime = 0 ) {
+ throw new MWException( "CAS is not implemented in " . __CLASS__ );
+ }
+
+ /**
* @param $key string
* @param $value mixed
* @param $exptime int
@@ -157,6 +169,17 @@ class MultiWriteBagOStuff extends BagOStuff {
}
/**
+ * @param $key string
+ * @param $callback closure 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
+ */
+ public function merge( $key, closure $callback, $exptime = 0, $attempts = 10 ) {
+ return $this->doWrite( 'merge', $key, $callback, $exptime );
+ }
+
+ /**
* @param $method string
* @return bool
*/