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

0.7.1 • Public • Published

loading-cache

Caching utility for NodeJS with loading functionality, based on ben-manes/caffeine

npm install --save @inventivetalent/loading-cache

Usage

import { Caches, Time, LoadingCache } from "@inventivetalent/loading-cache";

const cache = Caches.builder()
    .expireAfterWrite(Time.minutes(10))
    .expireAfterAccess(Time.minutes(5))
    .build(key => Math.random() * 100);
import { Caches, Time, AsyncLoadingCache } from "@inventivetalent/loading-cache";

const cache = Caches.builder()
    .expireAfterWrite(Time.minutes(10))
    .expireAfterAccess(Time.minutes(5))
    .buildAsync(
        key => new Promise(resolve => {
            setTimeout(() => {
                resolve(Math.random() * 100);
            }, Math.random() * 10);
        })
    );

/@inventivetalent/loading-cache/

    Package Sidebar

    Install

    npm i @inventivetalent/loading-cache

    Weekly Downloads

    304

    Version

    0.7.1

    License

    MIT

    Unpacked Size

    147 kB

    Total Files

    105

    Last publish

    Collaborators

    • inventivetalent