X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Fobjectcache%2FMemcachedBagOStuff.php;h=9f1c98ab58ef61fe97ccc8deacc07673105e45ba;hb=eee30a9434ba5ba2dc2f1c2b3b5632543fcbc773;hp=3d6bd16129dab7aeeb6fe7fe6b54332268fc5d3b;hpb=34d2b3aa238754621462cfaa10aa45c7751bf9a8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/objectcache/MemcachedBagOStuff.php b/includes/libs/objectcache/MemcachedBagOStuff.php index 3d6bd16129..9f1c98ab58 100644 --- a/includes/libs/objectcache/MemcachedBagOStuff.php +++ b/includes/libs/objectcache/MemcachedBagOStuff.php @@ -26,77 +26,12 @@ * * @ingroup Cache */ -class MemcachedBagOStuff extends BagOStuff { - /** @var MemcachedClient|Memcached */ - protected $client; - +abstract class MemcachedBagOStuff extends MediumSpecificBagOStuff { function __construct( array $params ) { parent::__construct( $params ); $this->attrMap[self::ATTR_SYNCWRITES] = self::QOS_SYNCWRITES_BE; // unreliable - } - - /** - * Fill in some defaults for missing keys in $params. - * - * @param array $params - * @return array - */ - protected function applyDefaultParams( $params ) { - return $params + [ - 'compress_threshold' => 1500, - 'connect_timeout' => 0.5, - 'debug' => false - ]; - } - - protected function doGet( $key, $flags = 0, &$casToken = null ) { - return $this->client->get( $this->validateKeyEncoding( $key ), $casToken ); - } - - public function set( $key, $value, $exptime = 0, $flags = 0 ) { - return $this->client->set( $this->validateKeyEncoding( $key ), $value, - $this->fixExpiry( $exptime ) ); - } - - protected function cas( $casToken, $key, $value, $exptime = 0, $flags = 0 ) { - return $this->client->cas( $casToken, $this->validateKeyEncoding( $key ), - $value, $this->fixExpiry( $exptime ) ); - } - - public function delete( $key, $flags = 0 ) { - return $this->client->delete( $this->validateKeyEncoding( $key ) ); - } - - public function add( $key, $value, $exptime = 0, $flags = 0 ) { - return $this->client->add( $this->validateKeyEncoding( $key ), $value, - $this->fixExpiry( $exptime ) ); - } - - public function incr( $key, $value = 1 ) { - $n = $this->client->incr( $this->validateKeyEncoding( $key ), $value ); - - return ( $n !== false && $n !== null ) ? $n : false; - } - - public function decr( $key, $value = 1 ) { - $n = $this->client->decr( $this->validateKeyEncoding( $key ), $value ); - - return ( $n !== false && $n !== null ) ? $n : false; - } - - public function changeTTL( $key, $exptime = 0, $flags = 0 ) { - return $this->client->touch( $this->validateKeyEncoding( $key ), - $this->fixExpiry( $exptime ) ); - } - - /** - * Get the underlying client object. This is provided for debugging - * purposes. - * @return MemcachedClient|Memcached - */ - public function getClient() { - return $this->client; + $this->segmentationSize = $params['maxPreferedKeySize'] ?? 917504; // < 1MiB } /**