1.3.1 • Published 5 years ago

job-cache v1.3.1

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

job-cache

A job queue that caches the job's result

Installation

$ npm i -S job-cache

Usage

const createCache = require('job-cache');
const cache = createCache();

// Adding a job with a cooldown (won't reschedule additional jobs with the same
// key if the cooldown is still in effect - counted from the job's finish time)
cache.add({
    key: 'foo',
    action: () => Promise.resolve('result'),
    cooldown: 1500
});

// Returns the last-run job's result.
cache.get('foo');

// Returns the entire cache ({key: result})
cache.getAll();
1.3.1

5 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago