/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @emails oncall+recoil * @flow strict * @format */ 'use strict'; const nullthrows = require('recoil-shared/util/Recoil_nullthrows'); type CacheNode = { key: K, value: V, left: ?CacheNode, right: ?CacheNode, }; type Options = { maxSize: number, mapKey?: (K) => mixed, }; declare class LRUCache { _maxSize: number, _size: number, _head: ?CacheNode, _tail: ?CacheNode, _map: Map>, _keyMapper: (K) => mixed, constructor(options: Options): any, head(): ?CacheNode, tail(): ?CacheNode, size(): number, maxSize(): number, has(key: K): boolean, get(key: K): ?V, set(key: K, val: V): void, _maybeDeleteLRU(): any, deleteLru(): void, delete(key: K): void, clear(): void, } module.exports = { LRUCache };