Move Title::isNamespaceProtected() to PermissionManager.
[lhc/web/wiklou.git] / includes / libs / objectcache / APCBagOStuff.php
index 5a36c65..aa83b1f 100644 (file)
@@ -33,7 +33,7 @@
  *
  * @ingroup Cache
  */
-class APCBagOStuff extends BagOStuff {
+class APCBagOStuff extends MediumSpecificBagOStuff {
        /** @var bool Whether to trust the APC implementation to serialization */
        private $nativeSerialize;
 
@@ -45,6 +45,7 @@ class APCBagOStuff extends BagOStuff {
        const KEY_SUFFIX = ':4';
 
        public function __construct( array $params = [] ) {
+               $params['segmentationSize'] = $params['segmentationSize'] ?? INF;
                parent::__construct( $params );
                // The extension serializer is still buggy, unlike "php" and "igbinary"
                $this->nativeSerialize = ( ini_get( 'apc.serializer' ) !== 'default' );
@@ -62,7 +63,7 @@ class APCBagOStuff extends BagOStuff {
                return $value;
        }
 
-       public function set( $key, $value, $exptime = 0, $flags = 0 ) {
+       protected function doSet( $key, $value, $exptime = 0, $flags = 0 ) {
                apc_store(
                        $key . self::KEY_SUFFIX,
                        $this->nativeSerialize ? $value : $this->serialize( $value ),
@@ -72,7 +73,7 @@ class APCBagOStuff extends BagOStuff {
                return true;
        }
 
-       public function add( $key, $value, $exptime = 0, $flags = 0 ) {
+       protected function doAdd( $key, $value, $exptime = 0, $flags = 0 ) {
                return apc_add(
                        $key . self::KEY_SUFFIX,
                        $this->nativeSerialize ? $value : $this->serialize( $value ),
@@ -80,7 +81,7 @@ class APCBagOStuff extends BagOStuff {
                );
        }
 
-       public function delete( $key, $flags = 0 ) {
+       protected function doDelete( $key, $flags = 0 ) {
                apc_delete( $key . self::KEY_SUFFIX );
 
                return true;
@@ -93,12 +94,4 @@ class APCBagOStuff extends BagOStuff {
        public function decr( $key, $value = 1 ) {
                return apc_dec( $key . self::KEY_SUFFIX, $value );
        }
-
-       protected function serialize( $value ) {
-               return $this->isInteger( $value ) ? (int)$value : serialize( $value );
-       }
-
-       protected function unserialize( $value ) {
-               return $this->isInteger( $value ) ? (int)$value : unserialize( $value );
-       }
 }