Skip to main content

Simple persistent caching.

Project description

rmmbr gives you a decorator you can place around async functions to have them be cached, locally or in the cloud.

Usage:

npm i rmmbr
import { cloudCache, localCache } from "rmmbr";

const cacher = await localCache({ id: "some-id" });

let nCalled = 0;
const f = (x: number) => {
  nCalled++;
  return Promise.resolve(x);
};
const fCached = cacher(f);
await fCached(3);
await fCached(3);
// nCalled is 1 here

The local cache stores data in a text file under a .rmmbr directory.

If you want to persist across devices, there is also a free to use cloud service:

const cacher = cloudCache({
  token: "service-token",
  url: "https://uriva-rmmbr.deno.dev",
});

As a free service, it comes with no guarantees, best effort only.

There is also a memCache, if you are feeling nostalgic 😉 and just want to store stuff in memory.

We accept issues for feature requests and SLA requests.

Python

pip install rmmbr

Python largely works the same, with mem_cache, local_cache and cloud_cache.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rmmbr-0.0.1.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

rmmbr-0.0.1-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page