simplekache

0.0.1 • Public • Published

SimpleKache

Simple library to chain and run functions with asynchronous calls.

Installation

Via npm on Node:

npm install simplekache

Usage

Reference in your program:

var sk = require('simplekache');

Create cache:

var cache = sk.create();

Get undefined item:

var item = sk.get('foo'); // null

Set and get item:

sk.set('one', 1);
var item = sk.get('one'); // 1

Set item with lifetime in microseconds:

sk.set('one', 1, { lifetime: 1000 });

If the item is not queried in one second, the value is removed from cache. If the item is queried in the past second, then the lifetime is extended ONE second more, not since the query time, but since the expiration check time.

Samples

TBD

Versions

  • 0.0.1 Published

License

MIT

References

Contribution

Feel free to file issues and submit pull requests � contributions are welcome<

If you submit a pull request, please be sure to add or update corresponding test cases, and ensure that npm test continues to pass.

Package Sidebar

Install

npm i simplekache

Weekly Downloads

0

Version

0.0.1

License

none

Last publish

Collaborators

  • ajlopez