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

1.1.5 • Public • Published

Installation

npm install --save @types/async-cache

Summary

This package contains type definitions for async-cache (https://github.com/isaacs/async-cache#readme).

Details

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

index.d.ts

import { Options as LRUOptions } from "lru-cache";

export = AsyncCache;

declare const AsyncCache: AsyncCacheFactory;

interface AsyncCacheFactory {
    <T>(options: AsyncCache.Options<T>): AsyncCache.Cache<T>;
    new<T>(options: AsyncCache.Options<T>): AsyncCache.Cache<T>;
}

declare namespace AsyncCache {
    interface Cache<T> {
        readonly itemCount: number;

        get(key: string, cb: (error: any, value: T) => void): void;
        keys(): string[];
        set(key: string, value: T, maxAge?: number): boolean;
        reset(): void;
        has(key: string): boolean;
        del(key: string): void;
        peek(key: string): T | undefined;
    }

    interface Options<T> extends LRUOptions<string, T> {
        load(key: string, callback: (error: any, asyncValue: T, maxAge?: number) => void): void;
    }
}

Additional Details

Credits

These definitions were written by BendingBender.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/async-cache

Weekly Downloads

25,270

Version

1.1.5

License

MIT

Unpacked Size

4.33 kB

Total Files

5

Last publish

Collaborators

  • types