Skip to content

stellaraf/cacheutil

Repository files navigation



Stellar JS Cache Utilities




@stellaraf/cacheutil provides a consistent caching API with support for multiple backends in the event that a library requires a cache but could be used on multiple platforms with different caching systems available. For example, if one needed to use a library on both Cloudflare Workers and a standard NodeJS application.

Supported Backends

Cloudflare KV

import { createCache } from "@stellaraf/cacheutil-cache";

const cache = createCache(env.KV_BINDING);

await cache.set("key", "value");
const value = await cache.get("key");
console.log(value);
// value

Redis

import { createCache } from "@stellaraf/cacheutil-cache";

const cache = createCache({ url: "redis://localhost:6379", database: 1 });

await cache.set("key", "value");
const value = await cache.get("key");
console.log(value);
// value

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors