rsvp-cache

Simple local caching library built on top of RSVP promises. This library has no dependency other than rsvp.js

Usage no npm install needed!

<script type="module">
  import rsvpCache from 'https://cdn.skypack.dev/rsvp-cache';
</script>

README

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",
...
  },