Neato Polyester Material

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

    0.6.9 • Public • Published

    loading-cache

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

    npm install --save @inventivetalent/loading-cache
    

    Usage

    Sync

    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);

    Async

    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);
            })
        );

    Install

    npm i @inventivetalent/loading-cache

    DownloadsWeekly Downloads

    74

    Version

    0.6.9

    License

    MIT

    Unpacked Size

    148 kB

    Total Files

    105

    Last publish

    Collaborators

    • inventivetalent