npm.io
1.1.4 • Published 2 years ago

@types/nano-cache

Licence
MIT
Version
1.1.4
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/nano-cache

Summary

This package contains type definitions for nano-cache (https://github.com/akhoury/nano-cache).

Details

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

index.d.ts

interface SIZE {
    GB: number;
    MB: number;
    KB: number;
}

interface Defaults {
    ttl?: number | undefined;
    limit?: number | undefined;
    bytes: number;
    compress: boolean;
    minFreeMem: number;
    maxEvictBytes: number;
}

interface Info {
    key: string;
    hits: number;
    accessed: number;
    updated: number;
    expires: number;
    value: unknown;
    bytes: number;
    ttl: number;
    compressed: boolean;
    cost: number;
    limit: number;
}

interface Stats {
    count: number;
    age: number;
    hits: number;
    evictions: number;
    misses: number;
    bytes: number;
}

interface Options {
    ttl?: number | undefined;
    limit?: number | undefined;
    bytes?: number | undefined;
    compress?: boolean | undefined;
    minFreeMem?: number | undefined;
    maxEvictBytes?: number | undefined;
}

declare class NanoCache {
    constructor(options?: Options);
    get(key: unknown): unknown;
    set(key: unknown, value: unknown, options?: Options): void;
    del(key: unknown): unknown;
    clear(): void;
    clearExpired(): void;
    isTTLExpired(key: unknown): boolean;
    isLimitReached(key: unknown): boolean;
    info(key: unknown): Info;
    stats(): Stats;
    static SIZE: SIZE;
    static DEFAULTS: Defaults;
    static singleton: NanoCache;
}

export = NanoCache;

Additional Details

  • Last updated: Tue, 07 Nov 2023 0939 GMT
  • Dependencies: none

Credits

These definitions were written by Ross Coundon.