Merge "build: Updating mediawiki/mediawiki-codesniffer to 22.0.0"
[lhc/web/wiklou.git] / includes / PageProps.php
index ff8deee..df2451c 100644 (file)
@@ -81,7 +81,7 @@ class PageProps {
         * Create a PageProps object
         */
        private function __construct() {
-               $this->cache = new ProcessCacheLRU( self::CACHE_SIZE );
+               $this->cache = new MapCacheLRU( self::CACHE_SIZE );
        }
 
        /**
@@ -89,8 +89,8 @@ class PageProps {
         * @param int $size
         */
        public function ensureCacheSize( $size ) {
-               if ( $this->cache->getSize() < $size ) {
-                       $this->cache->resize( $size );
+               if ( $this->cache->getMaxSize() < $size ) {
+                       $this->cache->setMaxSize( $size );
                }
        }
 
@@ -267,11 +267,11 @@ class PageProps {
         * @return string|bool property value array or false if not found
         */
        private function getCachedProperty( $pageID, $propertyName ) {
-               if ( $this->cache->has( $pageID, $propertyName, self::CACHE_TTL ) ) {
-                       return $this->cache->get( $pageID, $propertyName );
+               if ( $this->cache->hasField( $pageID, $propertyName, self::CACHE_TTL ) ) {
+                       return $this->cache->getField( $pageID, $propertyName );
                }
-               if ( $this->cache->has( 0, $pageID, self::CACHE_TTL ) ) {
-                       $pageProperties = $this->cache->get( 0, $pageID );
+               if ( $this->cache->hasField( 0, $pageID, self::CACHE_TTL ) ) {
+                       $pageProperties = $this->cache->getField( 0, $pageID );
                        if ( isset( $pageProperties[$propertyName] ) ) {
                                return $pageProperties[$propertyName];
                        }
@@ -286,8 +286,8 @@ class PageProps {
         * @return string|bool property value array or false if not found
         */
        private function getCachedProperties( $pageID ) {
-               if ( $this->cache->has( 0, $pageID, self::CACHE_TTL ) ) {
-                       return $this->cache->get( 0, $pageID );
+               if ( $this->cache->hasField( 0, $pageID, self::CACHE_TTL ) ) {
+                       return $this->cache->getField( 0, $pageID );
                }
                return false;
        }
@@ -300,7 +300,7 @@ class PageProps {
         * @param mixed $propertyValue value of property
         */
        private function cacheProperty( $pageID, $propertyName, $propertyValue ) {
-               $this->cache->set( $pageID, $propertyName, $propertyValue );
+               $this->cache->setField( $pageID, $propertyName, $propertyValue );
        }
 
        /**
@@ -311,6 +311,6 @@ class PageProps {
         */
        private function cacheProperties( $pageID, $pageProperties ) {
                $this->cache->clear( $pageID );
-               $this->cache->set( 0, $pageID, $pageProperties );
+               $this->cache->setField( 0, $pageID, $pageProperties );
        }
 }