Giter Site home page Giter Site logo

rmmbr's Introduction

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

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

If you want to persist across devices, we offer a free to use cloud service:

const cacher = cloudCache({
  token: "service-token",
  url: "https://uriva-rmmbr.deno.dev",
  ttl: 60 * 60 * 24, // Values will expire after one day, omission of this field implies max.
});

If your data is sensitive, you can encrypt it by adding an encryptionKey parameter:

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

Note that this is implemented as e2e encryption.

At the moment this service is with no guarantees, but we are working on a production tier as well. Please contact us or post an issue if you want to try it out!

We also accept issues for feature requests ๐Ÿ‘ฉโ€๐Ÿ”ง

Python

pip install rmmbr

The python api mimicks the js one, with exported decorators named mem_cache, local_cache and cloud_cache.

rmmbr's People

Contributors

uriva avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.