+ /**
+ * @param array $values Key/value map in order of increasingly recent access
+ * @param int $maxKeys
+ * @return MapCacheLRU
+ * @since 1.30
+ */
+ public static function newFromArray( array $values, $maxKeys ) {
+ $mapCache = new self( $maxKeys );
+ $mapCache->cache = ( count( $values ) > $maxKeys )
+ ? array_slice( $values, -$maxKeys, null, true )
+ : $values;
+
+ return $mapCache;
+ }
+
+ /**
+ * @return array Key/value map in order of increasingly recent access
+ * @since 1.30
+ */
+ public function toArray() {
+ return $this->cache;
+ }
+