Skip to main content

Simple persistent caching.

Project description

rmmbr

rmmbr

rmmbr is the simplest way to persistently cache async functions, locally or in the cloud with end to end encryption (e2ee).

Usage

rmmbr provides three APIs, in python and javascript.

  1. cloud caching - persist the cache across devices
  2. local file caching - persist on one device in a text file under a .rmmbr directory
  3. In memory caching - no persistence, if you are feeling nostalgic 😉

The cloud cache is free up to a quota. To use it, install the CLI tool:

source <(curl -s https://raw.githubusercontent.com/uriva/rmmbr/main/cli/install.sh)

To produce a service token:

rmmbr login
rmmbr api-token

For sensitive data, you can e2e encrypt it by adding an encryption key parameter.

To produce an encryption key:

rmmbr secret

Python

pip install rmmbr
from rmmbr import cloud_cache

cacher = cloud_cache(
    "https://rmmbr.net",
    "your-service-token",
    "some name for the cache",
    60 * 60 * 24, # TTL is one day.
    "Cqq33cbHu9AEUaP_wS3LCDQN7wy40XKWzALoPHbU5S8=",
)

n_called = 0

@cacher
async def f(x: int):
  nonlocal n_called
  n_called += 1
  return x

await f(3)
await f(3)
# nCalled is 1 here

Javascript / Typescript

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

const cacher = localCache({ id: "name of cache for my function" });

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

Cloud cache example:

const cacher = cloudCache({
  token: "service-token",
  cacheId: "some name for the cache",
  url: "https://rmmbr.net",
  ttl: 60 * 60 * 24, // Values will expire after one day. Omission implies max (one week).
  encryptionKey: "your-encryption-key", // This can be omitted if you don't need e2ee.
});

Pricing

Tier Requests Total data stored Max entry size # Entries
Free 10,000 10 MB 1 KB 1000
$100/month 1,000,000 1 GB 100 KB Unlimited

Regions

We currently deploy a backend in us-east region. Please post an issue if you have a need to configure this.

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.7.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

rmmbr-0.0.7-py3-none-any.whl (6.3 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