Performant caching for Deno
This library aims to bring you in memory caching, while trying to be as performant as possible for a high level language. Several caching policies are supported. Keys can have a timeout (ttl) after which they expire and are deleted from the cache. And the events can be emitted for different cache opterations.
With Deno it’s very easy to use third party libraries. Just import from one of the following urls.
deno.land/x
import { [cache-name] } from "https://deno.land/x/velo@0.1.3/mod.ts";
nest.land
import { [cache-name] } from "https://x.nest.land/velo@0.1.3/mod.ts";
All caches share the same set of methods.
import { LRU } from "https://deno.land/x/velo@v0.1.3/mod.ts";
const lru = new LRU({ capacity: 5 });
lru.set(1, 1);
lru.get(1);
lru.delete(1);
lru.set(2, 2, 60000); // with ttl
// event
lru.on("expired", (k, v) => {
console.log(k, v);
});
For more detailed examples take a look at the examples folder.
If you want to contribute to the project please read through our contributing guidelines.
Author: velo-org
Source Code: https://github.com/velo-org/velo
#deno #nodejs #javascript #node