• Version 10.2.2
  • Published
  • 681 kB
  • No dependencies
  • ISC license


npm i lru-cache
yarn add lru-cache
pnpm add lru-cache


A cache object that deletes the least-recently-used items.



variable TYPE

const TYPE: Symbol;
  • LRUCache


class LRUCache

class LRUCache<K extends {}, V extends {}, FC = unknown> implements Map<K, V> {}
  • Default export, the thing you're using this module to get.

    All properties from the options object (with the exception of OptionsBase.max and OptionsBase.maxSize) are added as normal public members. (max and maxBase are read-only getters.) Changing any of these will alter the defaults for subsequent method calls, but is otherwise safe.


constructor(options: LRUCache.Options<K, V, FC> | LRUCache<K, V, FC>);

    property [Symbol.toStringTag]

    [Symbol.toStringTag]: string;
    • A String value that is used in the creation of the default string description of an object. Called by the built-in method Object.prototype.toString.

    property allowStale

    allowStale: boolean;

    property allowStaleOnFetchAbort

    allowStaleOnFetchAbort: boolean;

    property allowStaleOnFetchRejection

    allowStaleOnFetchRejection: boolean;

    property calculatedSize

    readonly calculatedSize: number;
    • The total computed size of items in the cache (read-only)

    property dispose

    readonly dispose: LRUCache.Disposer<K, V>;

    property disposeAfter

    readonly disposeAfter: LRUCache.Disposer<K, V>;

    property fetchMethod

    readonly fetchMethod: LRUCache.Fetcher<K, V, FC>;

    property ignoreFetchAbort

    ignoreFetchAbort: boolean;

    property max

    readonly max: number;

    property maxEntrySize

    maxEntrySize: number;

    property maxSize

    readonly maxSize: number;

    property noDeleteOnFetchRejection

    noDeleteOnFetchRejection: boolean;

    property noDeleteOnStaleGet

    noDeleteOnStaleGet: boolean;

    property noDisposeOnSet

    noDisposeOnSet: boolean;

    property noUpdateTTL

    noUpdateTTL: boolean;

    property size

    readonly size: number;
    • The number of items stored in the cache (read-only)

    property sizeCalculation

    sizeCalculation?: LRUCache.SizeCalculator<K, V>;

    property ttl

    ttl: number;

    property ttlAutopurge

    ttlAutopurge: boolean;

    property ttlResolution

    ttlResolution: number;

    property updateAgeOnGet

    updateAgeOnGet: boolean;

    property updateAgeOnHas

    updateAgeOnHas: boolean;

    method [Symbol.iterator]

    [Symbol.iterator]: () => Generator<[K, V], void, unknown>;

    method clear

    clear: () => void;
    • Clear the cache entirely, throwing away all values.

    method delete

    delete: (k: K) => boolean;
    • Deletes a key out of the cache. Returns true if the key was deleted, false otherwise.

    method dump

    dump: () => [K, LRUCache.Entry<V>][];
    • Return an array of [key, LRUCache.Entry] tuples which can be passed to cache.load()

    method entries

    entries: () => Generator<[K, V], void, unknown>;
    • Return a generator yielding [key, value] pairs, in order from most recently used to least recently used.

    method fetch

    fetch: {
    k: K,
    fetchOptions: unknown extends FC
    ? LRUCache.FetchOptions<K, V, FC>
    : FC extends undefined | void
    ? LRUCache.FetchOptionsNoContext<K, V>
    : LRUCache.FetchOptionsWithContext<K, V, FC>
    ): Promise<undefined | V>;
    k: unknown extends FC ? K : FC extends void ? K : never,
    fetchOptions?: unknown extends FC
    ? LRUCache.FetchOptions<K, V, FC>
    : FC extends void
    ? LRUCache.FetchOptionsNoContext<K, V>
    : never
    ): Promise<V>;

    method find

    find: (
    fn: (v: V, k: K, self: LRUCache<K, V, FC>) => boolean,
    getOptions?: LRUCache.GetOptions<K, V, FC>
    ) => V | undefined;
    • Find a value for which the supplied fn method returns a truthy value, similar to Array.find(). fn is called as fn(value, key, cache).

    method forEach

    forEach: (
    fn: (v: V, k: K, self: LRUCache<K, V, FC>) => any,
    thisp?: any
    ) => void;
    • Call the supplied function on each item in the cache, in order from most recently used to least recently used. fn is called as fn(value, key, cache). Does not update age or recenty of use. Does not iterate over stale values.

    method get

    get: (k: K, getOptions?: LRUCache.GetOptions<K, V, FC>) => V | undefined;
    • Return a value from the cache. Will update the recency of the cache entry found.

      If the key is not found, get() will return undefined.

    method getRemainingTTL

    getRemainingTTL: (key: K) => number;
    • Return the remaining TTL time for a given entry key

    method has

    has: (k: K, hasOptions?: LRUCache.HasOptions<K, V, FC>) => boolean;
    • Check if a key is in the cache, without updating the recency of use. Will return false if the item is stale, even though it is technically in the cache.

      Will not update item age unless LRUCache.OptionsBase.updateAgeOnHas is set.

    method info

    info: (key: K) => LRUCache.Entry<V> | undefined;
    • Get the extended info about a given entry, to get its value, size, and TTL info simultaneously. Like LRUCache#dump, but just for a single key. Always returns stale values, if their info is found in the cache, so be sure to check for expired TTLs if relevant.

    method keys

    keys: () => Generator<K, void, unknown>;
    • Return a generator yielding the keys in the cache, in order from most recently used to least recently used.

    method load

    load: (arr: [K, LRUCache.Entry<V>][]) => void;
    • Reset the cache and load in the items in entries in the order listed. Note that the shape of the resulting cache may be different if the same options are not used in both caches.

    method peek

    peek: (k: K, peekOptions?: LRUCache.PeekOptions<K, V, FC>) => V | undefined;

    method pop

    pop: () => V | undefined;
    • Evict the least recently used item, returning its value or undefined if cache is empty.

    method purgeStale

    purgeStale: () => boolean;
    • Delete any stale entries. Returns true if anything was removed, false otherwise.

    method rentries

    rentries: () => Generator<
    (K | V | BackgroundFetch<V> | undefined)[],
    • Inverse order version of LRUCache.entries

      Return a generator yielding [key, value] pairs, in order from least recently used to most recently used.

    method rforEach

    rforEach: (
    fn: (v: V, k: K, self: LRUCache<K, V, FC>) => any,
    thisp?: any
    ) => void;
    • The same as LRUCache.forEach but items are iterated over in reverse order. (ie, less recently used items are iterated over first.)

    method rkeys

    rkeys: () => Generator<K, void, unknown>;
    • Inverse order version of LRUCache.keys

      Return a generator yielding the keys in the cache, in order from least recently used to most recently used.

    method rvalues

    rvalues: () => Generator<V | BackgroundFetch<V> | undefined, void, unknown>;
    • Inverse order version of LRUCache.values

      Return a generator yielding the values in the cache, in order from least recently used to most recently used.

    method set

    set: (
    k: K,
    v: V | BackgroundFetch<V> | undefined,
    setOptions?: LRUCache.SetOptions<K, V, FC>
    ) => this;
    • Add a value to the cache.

      Note: if undefined is specified as a value, this is an alias for LRUCache#delete

    method values

    values: () => Generator<V, void, unknown>;
    • Return a generator yielding the values in the cache, in order from most recently used to least recently used.

    class Stack

    class Stack {}


      constructor(max: number, HeapCls: new (n: number) => NumberArray);

        property heap

        heap: NumberArray;

          property length

          length: number;

            method create

            static create: (max: number) => StackLike;

              method pop

              pop: () => Index;

                method push

                push: (n: Index) => void;

                  class ZeroArray

                  class ZeroArray extends Array<number> {}


                    constructor(size: number);

                      Type Aliases

                      type BackgroundFetch

                      type BackgroundFetch<V> = Promise<V | undefined> & {
                      __returned: BackgroundFetch<V> | undefined;
                      __abortController: AbortController;
                      __staleWhileFetching: V | undefined;

                      type DisposeTask

                      type DisposeTask<K, V> = [value: V, key: K, reason: LRUCache.DisposeReason];

                        type Index

                        type Index = number & {
                        [TYPE]: 'LRUCache Index';

                          type NumberArray

                          type NumberArray = UintArray | number[];

                            type PosInt

                            type PosInt = number & {
                            [TYPE]: 'Positive Integer';

                              type StackLike

                              type StackLike = Stack | Index[];

                                type UintArray

                                type UintArray = Uint8Array | Uint16Array | Uint32Array;


                                  namespace LRUCache

                                  namespace LRUCache {}

                                    interface Entry

                                    interface Entry<V> {}

                                    property size

                                    size?: Size;

                                      property start

                                      start?: Milliseconds;

                                        property ttl

                                        ttl?: Milliseconds;

                                          property value

                                          value: V;

                                            interface FetcherFetchOptions

                                            interface FetcherFetchOptions<K, V, FC = unknown>
                                            extends Pick<
                                            OptionsBase<K, V, FC>,
                                            | 'allowStale'
                                            | 'updateAgeOnGet'
                                            | 'noDeleteOnStaleGet'
                                            | 'sizeCalculation'
                                            | 'ttl'
                                            | 'noDisposeOnSet'
                                            | 'noUpdateTTL'
                                            | 'noDeleteOnFetchRejection'
                                            | 'allowStaleOnFetchRejection'
                                            | 'ignoreFetchAbort'
                                            | 'allowStaleOnFetchAbort'
                                            > {}

                                            property size

                                            size?: Size;

                                              property status

                                              status?: Status<V>;

                                                interface FetcherOptions

                                                interface FetcherOptions<K, V, FC = unknown> {}

                                                property context

                                                context: FC;

                                                property options

                                                options: FetcherFetchOptions<K, V, FC>;

                                                  property signal

                                                  signal: AbortSignal;

                                                    interface FetchOptions

                                                    interface FetchOptions<K, V, FC> extends FetcherFetchOptions<K, V, FC> {}

                                                    property context

                                                    context?: FC;

                                                    property forceRefresh

                                                    forceRefresh?: boolean;
                                                    • Set to true to force a re-load of the existing data, even if it is not yet stale.

                                                    property signal

                                                    signal?: AbortSignal;

                                                      property status

                                                      status?: Status<V>;

                                                        interface FetchOptionsNoContext

                                                        interface FetchOptionsNoContext<K, V> extends FetchOptions<K, V, undefined> {}
                                                        • Options provided to LRUCache#fetch when the FC type is undefined or void

                                                        property context

                                                        context?: undefined;

                                                          interface FetchOptionsWithContext

                                                          interface FetchOptionsWithContext<K, V, FC> extends FetchOptions<K, V, FC> {}
                                                          • Options provided to LRUCache#fetch when the FC type is something other than unknown, undefined, or void

                                                          property context

                                                          context: FC;

                                                            interface GetOptions

                                                            interface GetOptions<K, V, FC>
                                                            extends Pick<
                                                            OptionsBase<K, V, FC>,
                                                            'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet'
                                                            > {}

                                                            property status

                                                            status?: Status<V>;

                                                              interface HasOptions

                                                              interface HasOptions<K, V, FC>
                                                              extends Pick<OptionsBase<K, V, FC>, 'updateAgeOnHas'> {}

                                                              property status

                                                              status?: Status<V>;

                                                                interface OptionsBase

                                                                interface OptionsBase<K, V, FC> {}
                                                                • Options which may be passed to the LRUCache constructor.

                                                                  Most of these may be overridden in the various options that use them.

                                                                  Despite all being technically optional, the constructor requires that a cache is at minimum limited by one or more of OptionsBase.max, OptionsBase.ttl, or OptionsBase.maxSize.

                                                                  If OptionsBase.ttl is used alone, then it is strongly advised (and in fact required by the type definitions here) that the cache also set OptionsBase.ttlAutopurge, to prevent potentially unbounded storage.

                                                                property allowStale

                                                                allowStale?: boolean;

                                                                property allowStaleOnFetchAbort

                                                                allowStaleOnFetchAbort?: boolean;
                                                                • Set to true to return a stale value from the cache when the AbortSignal passed to the OptionsBase.fetchMethod dispatches an 'abort' event, whether user-triggered, or due to internal cache behavior.

                                                                  Unless OptionsBase.ignoreFetchAbort is also set, the underlying OptionsBase.fetchMethod will still be considered canceled, and any value it returns will be ignored and not cached.

                                                                  Caveat: since fetches are aborted when a new value is explicitly set in the cache, this can lead to fetch returning a stale value, since that was the fallback value _at the moment the fetch() was initiated_, even though the new updated value is now present in the cache.

                                                                  For example:

                                                                  const cache = new LRUCache<string, any>({
                                                                  ttl: 100,
                                                                  fetchMethod: async (url, oldValue, { signal }) => {
                                                                  const res = await fetch(url, { signal })
                                                                  return await res.json()
                                                                  cache.set('', { some: 'data' })
                                                                  // 100ms go by...
                                                                  const result = cache.fetch('')
                                                                  cache.set('', { other: 'thing' })
                                                                  console.log(await result) // { some: 'data' }
                                                                  console.log(cache.get('')) // { other: 'thing' }

                                                                property allowStaleOnFetchRejection

                                                                allowStaleOnFetchRejection?: boolean;

                                                                property dispose

                                                                dispose?: Disposer<K, V>;
                                                                • Function that is called on items when they are dropped from the cache. This can be handy if you want to close file descriptors or do other cleanup tasks when items are no longer accessible. Called with `key, value`. It's called before actually removing the item from the internal cache, so it is *NOT* safe to re-add them.

                                                                  Use OptionsBase.disposeAfter if you wish to dispose items after they have been full removed, when it is safe to add them back to the cache.

                                                                property disposeAfter

                                                                disposeAfter?: Disposer<K, V>;
                                                                • The same as OptionsBase.dispose, but called *after* the entry is completely removed and the cache is once again in a clean state. It is safe to add an item right back into the cache at this point. However, note that it is *very* easy to inadvertently create infinite recursion this way.

                                                                property fetchMethod

                                                                fetchMethod?: Fetcher<K, V, FC>;

                                                                property ignoreFetchAbort

                                                                ignoreFetchAbort?: boolean;
                                                                • Set to true to ignore the abort event emitted by the AbortSignal object passed to OptionsBase.fetchMethod, and still cache the resulting resolution value, as long as it is not undefined.

                                                                  When used on its own, this means aborted LRUCache#fetch calls are not immediately resolved or rejected when they are aborted, and instead take the full time to await.

                                                                  When used with OptionsBase.allowStaleOnFetchAbort, aborted LRUCache#fetch calls will resolve immediately to their stale cached value or undefined, and will continue to process and eventually update the cache when they resolve, as long as the resulting value is not undefined, thus supporting a "return stale on timeout while refreshing" mechanism by passing AbortSignal.timeout(n) as the signal.

                                                                  **Note**: regardless of this setting, an abort event _is still emitted on the AbortSignal object_, so may result in invalid results when passed to other underlying APIs that use AbortSignals.

                                                                  This may be overridden in the OptionsBase.fetchMethod or the call to LRUCache#fetch.

                                                                property max

                                                                max?: Count;
                                                                • The maximum number of items to store in the cache before evicting old entries. This is read-only on the LRUCache instance, and may not be overridden.

                                                                  If set, then storage space will be pre-allocated at construction time, and the cache will perform significantly faster.

                                                                  Note that significantly fewer items may be stored, if OptionsBase.maxSize and/or OptionsBase.ttl are also set.

                                                                property maxEntrySize

                                                                maxEntrySize?: Size;
                                                                • The maximum allowed size for any single item in the cache.

                                                                  If a larger item is passed to LRUCache#set or returned by a OptionsBase.fetchMethod, then it will not be stored in the cache.

                                                                property maxSize

                                                                maxSize?: Size;
                                                                • If you wish to track item size, you must provide a maxSize note that we still will only keep up to max *actual items*, if max is set, so size tracking may cause fewer than max items to be stored. At the extreme, a single item of maxSize size will cause everything else in the cache to be dropped when it is added. Use with caution!

                                                                  Note also that size tracking can negatively impact performance, though for most cases, only minimally.

                                                                property noDeleteOnFetchRejection

                                                                noDeleteOnFetchRejection?: boolean;

                                                                property noDeleteOnStaleGet

                                                                noDeleteOnStaleGet?: boolean;

                                                                property noDisposeOnSet

                                                                noDisposeOnSet?: boolean;
                                                                • Set to true to suppress calling the OptionsBase.dispose function if the entry key is still accessible within the cache. This may be overridden by passing an options object to LRUCache#set.

                                                                property noUpdateTTL

                                                                noUpdateTTL?: boolean;
                                                                • Boolean flag to tell the cache to not update the TTL when setting a new value for an existing key (ie, when updating a value rather than inserting a new value). Note that the TTL value is _always_ set (if provided) when adding a new entry into the cache.

                                                                  Has no effect if a OptionsBase.ttl is not set.

                                                                property sizeCalculation

                                                                sizeCalculation?: SizeCalculator<K, V>;

                                                                property ttl

                                                                ttl?: Milliseconds;
                                                                • Max time in milliseconds for items to live in cache before they are considered stale. Note that stale items are NOT preemptively removed by default, and MAY live in the cache long after they have expired.

                                                                  Also, as this cache is optimized for LRU/MRU operations, some of the staleness/TTL checks will reduce performance, as they will incur overhead by deleting items.

                                                                  Must be an integer number of ms. If set to 0, this indicates "no TTL"


                                                                property ttlAutopurge

                                                                ttlAutopurge?: boolean;
                                                                • Preemptively remove stale items from the cache. Note that this may significantly degrade performance, especially if the cache is storing a large number of items. It is almost always best to just leave the stale items in the cache, and let them fall out as new items are added.

                                                                  Note that this means that OptionsBase.allowStale is a bit pointless, as stale items will be deleted almost as soon as they expire.


                                                                property ttlResolution

                                                                ttlResolution?: Milliseconds;
                                                                • Minimum amount of time in ms in which to check for staleness. Defaults to 1, which means that the current time is checked at most once per millisecond.

                                                                  Set to 0 to check the current time every time staleness is tested. (This reduces performance, and is theoretically unnecessary.)

                                                                  Setting this to a higher value will improve performance somewhat while using ttl tracking, albeit at the expense of keeping stale items around a bit longer than their TTLs would indicate.


                                                                property updateAgeOnGet

                                                                updateAgeOnGet?: boolean;

                                                                property updateAgeOnHas

                                                                updateAgeOnHas?: boolean;

                                                                interface OptionsMaxLimit

                                                                interface OptionsMaxLimit<K, V, FC> extends OptionsBase<K, V, FC> {}

                                                                  property max

                                                                  max: Count;

                                                                    interface OptionsSizeLimit

                                                                    interface OptionsSizeLimit<K, V, FC> extends OptionsBase<K, V, FC> {}

                                                                      property maxSize

                                                                      maxSize: Size;

                                                                        interface OptionsTTLLimit

                                                                        interface OptionsTTLLimit<K, V, FC> extends OptionsBase<K, V, FC> {}

                                                                          property ttl

                                                                          ttl: Milliseconds;

                                                                            property ttlAutopurge

                                                                            ttlAutopurge: boolean;

                                                                              interface PeekOptions

                                                                              interface PeekOptions<K, V, FC> extends Pick<OptionsBase<K, V, FC>, 'allowStale'> {}

                                                                              interface SetOptions

                                                                              interface SetOptions<K, V, FC>
                                                                              extends Pick<
                                                                              OptionsBase<K, V, FC>,
                                                                              'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL'
                                                                              > {}

                                                                              property size

                                                                              size?: Size;

                                                                              property start

                                                                              start?: Milliseconds;
                                                                              • If TTL tracking is enabled, then setting an explicit start time in the LRUCache#set call will override the default time from or

                                                                                Note that it must be a valid value for whichever time-tracking method is in use.

                                                                              property status

                                                                              status?: Status<V>;

                                                                                interface Status

                                                                                interface Status<V> {}

                                                                                property entrySize

                                                                                entrySize?: Size;
                                                                                • The calculated size for the item, if sizes are used.

                                                                                property fetch

                                                                                fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh';
                                                                                • The status of a LRUCache#fetch operation. Note that this can change as the underlying fetch() moves through various states.

                                                                                  - inflight: there is another fetch() for this key which is in process - get: there is no fetchMethod, so LRUCache#get was called. - miss: the item is not in cache, and will be fetched. - hit: the item is in the cache, and was resolved immediately. - stale: the item is in the cache, but stale. - refresh: the item is in the cache, and not stale, but FetchOptions.forceRefresh was specified.

                                                                                property fetchAborted

                                                                                fetchAborted?: true;
                                                                                • The fetch received an abort signal

                                                                                property fetchAbortIgnored

                                                                                fetchAbortIgnored?: true;
                                                                                • The abort signal received was ignored, and the fetch was allowed to continue.

                                                                                property fetchDispatched

                                                                                fetchDispatched?: true;

                                                                                property fetchError

                                                                                fetchError?: Error;
                                                                                • The reason for a fetch() rejection. Either the error raised by the OptionsBase.fetchMethod, or the reason for an AbortSignal.

                                                                                property fetchRejected

                                                                                fetchRejected?: true;
                                                                                • The fetchMethod promise was rejected

                                                                                property fetchResolved

                                                                                fetchResolved?: true;
                                                                                • The fetchMethod promise resolved successfully

                                                                                property fetchUpdated

                                                                                fetchUpdated?: true;

                                                                                property get

                                                                                get?: 'stale' | 'hit' | 'miss';
                                                                                • The status of a LRUCache#get operation.

                                                                                  - fetching: The item is currently being fetched. If a previous value is present and allowed, that will be returned. - stale: The item is in the cache, and is stale. - hit: the item is in the cache - miss: the item is not in the cache

                                                                                property has

                                                                                has?: 'hit' | 'stale' | 'miss';
                                                                                • The results of a LRUCache#has operation

                                                                                  - hit: the item was found in the cache - stale: the item was found in the cache, but is stale - miss: the item was not found in the cache

                                                                                property maxEntrySizeExceeded

                                                                                maxEntrySizeExceeded?: true;

                                                                                property now

                                                                                now?: Milliseconds;
                                                                                • The timestamp used for TTL calculation

                                                                                property oldValue

                                                                                oldValue?: V;
                                                                                • The old value, specified in the case of set:'update' or set:'replace'

                                                                                property remainingTTL

                                                                                remainingTTL?: Milliseconds;
                                                                                • the remaining ttl for the item, or undefined if ttls are not used.

                                                                                property returnedStale

                                                                                returnedStale?: true;
                                                                                • A fetch or get operation returned a stale value.

                                                                                property set

                                                                                set?: 'add' | 'update' | 'replace' | 'miss';
                                                                                • The status of a set() operation.

                                                                                  - add: the item was not found in the cache, and was added - update: the item was in the cache, with the same value provided - replace: the item was in the cache, and replaced - miss: the item was not added to the cache for some reason

                                                                                property start

                                                                                start?: Milliseconds;
                                                                                • the start time for the item, or undefined if ttls are not used.

                                                                                property totalCalculatedSize

                                                                                totalCalculatedSize?: Size;
                                                                                • The total calculated size of the cache, if sizes are used.

                                                                                property ttl

                                                                                ttl?: Milliseconds;
                                                                                • the ttl stored for the item, or undefined if ttls are not used.

                                                                                type Count

                                                                                type Count = number;
                                                                                • An integer greater than 0, reflecting a number of items

                                                                                type Disposer

                                                                                type Disposer<K, V> = (value: V, key: K, reason: DisposeReason) => void;

                                                                                type DisposeReason

                                                                                type DisposeReason = 'evict' | 'set' | 'delete';
                                                                                • The reason why an item was removed from the cache, passed to the Disposer methods.

                                                                                type Fetcher

                                                                                type Fetcher<K, V, FC = unknown> = (
                                                                                key: K,
                                                                                staleValue: V | undefined,
                                                                                options: FetcherOptions<K, V, FC>
                                                                                ) => Promise<V | undefined | void> | V | undefined | void;

                                                                                type Milliseconds

                                                                                type Milliseconds = number;
                                                                                • Integer greater than 0, representing some number of milliseconds, or the time at which a TTL started counting from.

                                                                                type Options

                                                                                type Options<K, V, FC> =
                                                                                | OptionsMaxLimit<K, V, FC>
                                                                                | OptionsSizeLimit<K, V, FC>
                                                                                | OptionsTTLLimit<K, V, FC>;
                                                                                • The valid safe options for the LRUCache constructor

                                                                                type Size

                                                                                type Size = number;
                                                                                • An integer greater than 0, reflecting the calculated size of items

                                                                                type SizeCalculator

                                                                                type SizeCalculator<K, V> = (value: V, key: K) => Size;
                                                                                • A function that returns the effective calculated size of an entry in the cache.

                                                                                Package Files (1)

                                                                                Dependencies (0)

                                                                                No dependencies.

                                                                                Dev Dependencies (15)

                                                                                Peer Dependencies (0)

                                                                                No peer dependencies.


                                                                                To add a badge like this badgeto your package's README, use the codes available below.

                                                                                You may also use to create a custom badge linking to

                                                                                • Markdown
                                                                                • HTML
                                                                                  <a href=""><img src="" alt=""></a>