mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
# Conflicts: # acl/index.d.ts # anydb-sql-migrations/anydb-sql-migrations.d.ts # asana/asana.d.ts # blue-tape/blue-tape-tests.ts # bluebird-retry/bluebird-retry-tests.ts # bluebird-retry/bluebird-retry.d.ts # bluebird/index.d.ts # bookshelf/bookshelf.d.ts # consolidate/consolidate.d.ts # documentdb/documentdb.d.ts # fs-extra-promise/fs-extra-promise.d.ts # graphene-pk11/graphene-pk11.d.ts # inline-css/inline-css.d.ts # inversify/index.d.ts # java/java-tests.ts # karma/karma.d.ts # knex/knex.d.ts # koa-router/koa-router.d.ts # libxmljs/libxmljs-tests.ts # lru-cache/lru-cache.d.ts # mz/index.d.ts # node-mysql-wrapper/node-mysql-wrapper-tests.ts # node-mysql-wrapper/node-mysql-wrapper.d.ts # nodemailer/nodemailer.d.ts # pify/pify-tests.ts # project-oxford/project-oxford-tests.ts # project-oxford/project-oxford.d.ts # react-router/react-router-tests.tsx # react-scroll/react-scroll.d.ts # redlock/redlock.d.ts # request-promise/index.d.ts # rethinkdb/rethinkdb.d.ts # sequelize/sequelize.d.ts # stamplay-js-sdk/index.d.ts # stripe-node/stripe-node.d.ts # umzug/umzug.d.ts
36 lines
1010 B
TypeScript
36 lines
1010 B
TypeScript
// Type definitions for lru-cache v2.5.0
|
|
// Project: https://github.com/isaacs/node-lru-cache
|
|
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
|
|
declare function LRU<T>(opts: LRU.Options<T>): LRU.Cache<T>;
|
|
declare function LRU<T>(max: number): LRU.Cache<T>;
|
|
|
|
declare namespace LRU {
|
|
interface Options<T> {
|
|
max?: number;
|
|
maxAge?: number;
|
|
length?: (value: T) => number;
|
|
dispose?: (key: any, value: T) => void;
|
|
stale?: boolean;
|
|
}
|
|
|
|
interface Cache<T> {
|
|
set(key: any, value: T, maxAge?: number): void;
|
|
get(key: any): T;
|
|
peek(key: any): T;
|
|
has(key: any): boolean
|
|
del(key: any): void;
|
|
reset(): void;
|
|
prune(): void;
|
|
forEach(iter: (value: T, key: any, cache: Cache<T>) => void, thisp?: any): void;
|
|
itemCount: number;
|
|
length: number
|
|
keys(): any[];
|
|
values(): T[];
|
|
}
|
|
}
|
|
|
|
export = LRU;
|