Necrotizing Pineapple Music

    @types/stale-lru-cache
    TypeScript icon, indicating that this package has built-in type declarations

    5.1.3 • Public • Published

    Installation

    npm install --save @types/stale-lru-cache

    Summary

    This package contains type definitions for stale-lru-cache (https://github.com/cyberthom/stale-lru-cache).

    Details

    Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/stale-lru-cache.

    index.d.ts

    // Type definitions for stale-lru-cache 5.1
    // Project: https://github.com/cyberthom/stale-lru-cache
    // Definitions by: Joona Heikkilä <https://github.com/cxcorp>
    // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
    
    declare class Cache<K, V> {
        constructor(options?: Cache.CacheOptions<K, V>);
        delete(key: K): boolean;
        get(key: K): V | undefined;
        set(key: K, value: V, options?: string | Cache.SetOptions<K, V>): boolean;
        has(key: K): boolean;
        isStale(key: K): boolean;
        keys(): K[];
        reset(): void;
        size(): number;
        values(): V[];
        wrap(
            key: K,
            revalidate: Cache.RevalidationCallback<K, V>,
            callback: Cache.OptionsCallback<K, V>
        ): void;
    }
    
    declare namespace Cache {
        type OptionsCallback<K, V> = (error: any, value?: V, options?: string | SetOptions<K, V>) => void;
        type RevalidationCallback<K, V> = (key: K, callback: OptionsCallback<K, V>) => void;
    
        interface CacheOptions<K, V> {
            maxAge?: number | undefined;
            staleWhileRevalidate?: number | undefined;
            revalidate?: RevalidationCallback<K, V> | undefined;
            maxSize?: number | undefined;
            getSize?(value: V, key: K): number;
        }
    
        interface SetOptions<K, V> {
            maxAge?: number | undefined;
            staleWhileRevalidate?: number | undefined;
            revalidate?: RevalidationCallback<K, V> | undefined;
        }
    }
    
    export = Cache;

    Additional Details

    • Last updated: Fri, 02 Jul 2021 22:32:52 GMT
    • Dependencies: none
    • Global values: none

    Credits

    These definitions were written by Joona Heikkilä.

    Keywords

    none

    Install

    npm i @types/stale-lru-cache

    DownloadsWeekly Downloads

    1,832

    Version

    5.1.3

    License

    MIT

    Unpacked Size

    5.46 kB

    Total Files

    4

    Last publish

    Collaborators

    • types