Merge "Put block cookie expiry into UTC for comparison with current time"
[lhc/web/wiklou.git] / includes / libs / objectcache / RESTBagOStuff.php
index a10d1a4..b8ce38b 100644 (file)
@@ -44,7 +44,7 @@ use Psr\Log\LoggerInterface;
  * $wgSessionCacheType = 'sessions';
  * @endcode
  */
-class RESTBagOStuff extends BagOStuff {
+class RESTBagOStuff extends MediumSpecificBagOStuff {
        /**
         * Default connection timeout in seconds. The kernel retransmits the SYN
         * packet after 1 second, so 1.2 seconds allows for 1 retransmit without
@@ -79,6 +79,7 @@ class RESTBagOStuff extends BagOStuff {
        private $extendedErrorBodyFields;
 
        public function __construct( $params ) {
+               $params['segmentationSize'] = $params['segmentationSize'] ?? INF;
                if ( empty( $params['url'] ) ) {
                        throw new InvalidArgumentException( 'URL parameter is required' );
                }
@@ -146,7 +147,7 @@ class RESTBagOStuff extends BagOStuff {
                return false;
        }
 
-       public function set( $key, $value, $exptime = 0, $flags = 0 ) {
+       protected function doSet( $key, $value, $exptime = 0, $flags = 0 ) {
                // @TODO: respect WRITE_SYNC (e.g. EACH_QUORUM)
                // @TODO: respect $exptime
                $req = [
@@ -163,7 +164,7 @@ class RESTBagOStuff extends BagOStuff {
                return $this->handleError( "Failed to store $key", $rcode, $rerr, $rhdrs, $rbody );
        }
 
-       public function add( $key, $value, $exptime = 0, $flags = 0 ) {
+       protected function doAdd( $key, $value, $exptime = 0, $flags = 0 ) {
                // @TODO: make this atomic
                if ( $this->get( $key ) === false ) {
                        return $this->set( $key, $value, $exptime, $flags );
@@ -172,7 +173,7 @@ class RESTBagOStuff extends BagOStuff {
                return false; // key already set
        }
 
-       public function delete( $key, $flags = 0 ) {
+       protected function doDelete( $key, $flags = 0 ) {
                // @TODO: respect WRITE_SYNC (e.g. EACH_QUORUM)
                $req = [
                        'method' => 'DELETE',