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).

Motivation

Caching is a great way to save costs and time calling remote APIs.

Most programming languages already have solutions for in-memory caching. These work well if your service is long-running on one machine. However, if your service restarts, then you lose your cache. In addition if you are running more than one instance, they don't share caches.

Making caches persistent across runs requires deploying another service which writes to disk or to a database. This means to set it up is a substantial context switch for the developer. The last thing you want to think of while doing unrelated work is another service to maintain, and how to write code to communicate to this service.

As this use case is quite common, it would be desired to have an easy way to do it, right from your command line and code editor, and without any context switching.

Usage

rmmbr provides APIs in Python and JavaScript/TypeScript.

If token is provided, the library will persist the cache across devices, otherwise everything would be stored in a file under a .rmmbr directory.

Install the CLI tool:

curl -s https://raw.githubusercontent.com/uriva/rmmbr/main/cli/install.sh | sudo bash

Produce a service token:

rmmbr login
rmmbr token -g

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

Produce an encryption key:

rmmbr secret

Python

pip install rmmbr
from rmmbr import cache

n_called = 0

@cache(
    "some name for the cache",
    60 * 60 * 24, # TTL is one day.
    "Cqq33cbHu9AEUaP_wS3LCDQN7wy40XKWzALoPHbU5S8=",
    "https://rmmbr.net",
    "your-service-token",
)
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 { cache } from "rmmbr";

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

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

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.

Legal

FAQ

How do I sign up?

Download the cli and run:

rmmbr login

How do I change tier?

We will contact you when your exceeds the free tier.

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.9.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rmmbr-0.0.9-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file rmmbr-0.0.9.tar.gz.

File metadata

  • Download URL: rmmbr-0.0.9.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for rmmbr-0.0.9.tar.gz
Algorithm Hash digest
SHA256 fb3bab28d6b3c565ac4a672fbd3abfef39a94ab2175419ec2180df1640e5167f
MD5 c4afa438b832b415e1a901cbf414f06b
BLAKE2b-256 bd2b67f6ef88671efad28f4fde6f28d5ecad53948c4e7b214c4af437fe804b19

See more details on using hashes here.

File details

Details for the file rmmbr-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: rmmbr-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for rmmbr-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 2b9483e32eb82b3b2e590e61073a609f95c14030a4377b1e0026b6ce0ac4e072
MD5 e4cf537947811f8579f72b86b390bdec
BLAKE2b-256 2c27f1d08f27ccce5bbe9247268a0b5082a0f46fe36a56a74e842775590377d3

See more details on using hashes here.

Supported by

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