rsvp-cache

1.0.0 • Public • Published

RSVP Cache

Overview

RSVP Cache is a lightweight library that provides an access to various caching mechanisms using rsvp Promises.

Simple Usage Sample

var cache = require('rsvp-cache');
 
var simpleCache = new cache.SimpleObjectCache();
simpleCache.setValue('key, value');
 
var promise = simpleCache.getValue('key', function () {
  // load function - lengthy calculation/loading process...
  heavyLoadPromise = ajax.request('POST', '/make/lots/calculations');
  return heavyLoadPromise;
});
 
promise.then(function (data) {
  console.log(data); // prints 'value' as it was cached on the line with setValue above
});

Including in your package.json:

  "devDependencies": {
...
    "rsvp-ajax": "^1.0.0",
...
  },

Readme

Keywords

Package Sidebar

Install

npm i rsvp-cache

Weekly Downloads

0

Version

1.0.0

License

Apache-2.0

Last publish

Collaborators

  • avshabanov