New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lite-cache-js

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lite-cache-js

Store any JS data in memory with ttl and extend expire date when getting data

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Lite! Only ~55 lines.

Caching module to hold any JS values in RAM for quick access. Objects are removed after expire time every 2 minutes or while calling get()

Install

npm i lite-cache-js --save

USAGE

const cache = require('lite-cache-js');

cache.set({key, value, ttl_ms});
cache.get({key, new_ttl_ms});
cache.remove({key});
cache.clear();
get

will return null or value

new_ttl_ms - If set cache's expire date will be set by this ttl. In milliseconds.

 let value = cache.get({key: 'any valid js object key', new_ttl_ms: 300});
set

will set/update value in cache. ttl_ms - time to live in milliseconds. 1000 = 1 second.

cache.set({
   key: 'any valid js object key',
   value: 'any valid object value',
  ttl_ms: 1000,
  })
remove

will remove single value from cache.

cache.remove({key: 'any valid js object key'})
clear

will remove all values from cache

cache.clear();

Keywords

FAQs

Package last updated on 16 Aug 2021

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc