Socket
Book a DemoInstallSign in
Socket

cache-result

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-result

> You cache the results you know when to flush'em

0.1.1
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

cache-result

You cache the results you know when to flush'em

npm install cache-result

It deals with nested cache without taking size into consideration. Instead, you decided what part of caching is not related anymore and what part should be preserved.

Usage

const cache = require("cache-result");

const { set, get, clear } = cache();

Each function take object input:

  • branch: string - To set working branch for cache
  • key: string - key to value in cache

set({ branch, key }, result)

get({ branch, key })

clear({ branch, key })

To delete the whole branch pass clear({ branch }) without key

const cache = require("../src");

const { set, get, clear } = cache();

set({ branch: "foo", key: "hello" }, "sunshine");
set({ branch: "bar", key: "by" }, "sunset");

get({ branch: "foo", key: "hello" }); // sunshine
get({ branch: "bar", key: "by" }); // sunset

clear({ branch, "foo" });
get({ branch: "foo", key: "hello" }); // null
get({ branch: "bar", key: "by" }); // sunset

Test

npm test

License

This project is licensed under the GPL-3.0 License

Keywords

lru

FAQs

Package last updated on 12 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.