objectcache: define some missing methods in ReplicatedBagOStuff
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 27 Mar 2019 02:37:31 +0000 (19:37 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 27 Mar 2019 02:41:11 +0000 (19:41 -0700)
Also reorder methods to match the base class so it is easier
to compare the classes and see which methods should be defined.

Change-Id: I2b8c2cd63822ce49efd9b4b7e44bde92032b5a98

includes/libs/objectcache/ReplicatedBagOStuff.php

index 14e2fef..eb3f6f8 100644 (file)
@@ -80,38 +80,24 @@ class ReplicatedBagOStuff extends BagOStuff {
                        : $this->readStore->get( $key, $flags );
        }
 
-       public function getMulti( array $keys, $flags = 0 ) {
-               return ( $flags & self::READ_LATEST )
-                       ? $this->writeStore->getMulti( $keys, $flags )
-                       : $this->readStore->getMulti( $keys, $flags );
-       }
-
        public function set( $key, $value, $exptime = 0, $flags = 0 ) {
                return $this->writeStore->set( $key, $value, $exptime, $flags );
        }
 
-       public function setMulti( array $keys, $exptime = 0, $flags = 0 ) {
-               return $this->writeStore->setMulti( $keys, $exptime, $flags );
-       }
-
        public function delete( $key, $flags = 0 ) {
                return $this->writeStore->delete( $key, $flags );
        }
 
-       public function deleteMulti( array $keys, $flags = 0 ) {
-               return $this->writeStore->deleteMulti( $keys, $flags );
-       }
-
        public function add( $key, $value, $exptime = 0, $flags = 0 ) {
                return $this->writeStore->add( $key, $value, $exptime, $flags );
        }
 
-       public function incr( $key, $value = 1 ) {
-               return $this->writeStore->incr( $key, $value );
+       public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
+               return $this->writeStore->merge( $key, $callback, $exptime, $attempts, $flags );
        }
 
-       public function decr( $key, $value = 1 ) {
-               return $this->writeStore->decr( $key, $value );
+       public function changeTTL( $key, $exptime = 0, $flags = 0 ) {
+               return $this->writeStore->changeTTL( $key, $exptime, $flags );
        }
 
        public function lock( $key, $timeout = 6, $expiry = 6, $rclass = '' ) {
@@ -122,8 +108,34 @@ class ReplicatedBagOStuff extends BagOStuff {
                return $this->writeStore->unlock( $key );
        }
 
-       public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
-               return $this->writeStore->merge( $key, $callback, $exptime, $attempts, $flags );
+       public function deleteObjectsExpiringBefore( $date, $progressCallback = false ) {
+               return $this->writeStore->deleteObjectsExpiringBefore( $date, $progressCallback );
+       }
+
+       public function getMulti( array $keys, $flags = 0 ) {
+               return ( ( $flags & self::READ_LATEST ) == self::READ_LATEST )
+                       ? $this->writeStore->getMulti( $keys, $flags )
+                       : $this->readStore->getMulti( $keys, $flags );
+       }
+
+       public function setMulti( array $data, $exptime = 0, $flags = 0 ) {
+               return $this->writeStore->setMulti( $data, $exptime, $flags );
+       }
+
+       public function deleteMulti( array $keys, $flags = 0 ) {
+               return $this->writeStore->deleteMulti( $keys, $flags );
+       }
+
+       public function incr( $key, $value = 1 ) {
+               return $this->writeStore->incr( $key, $value );
+       }
+
+       public function decr( $key, $value = 1 ) {
+               return $this->writeStore->decr( $key, $value );
+       }
+
+       public function incrWithInit( $key, $ttl, $value = 1, $init = 1 ) {
+               return $this->writeStore->incrWithInit( $key, $ttl, $value, $init );
        }
 
        public function getLastError() {