Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

memory-cache

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memory-cache

A simple in-memory cache. put(), get() and del()

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is memory-cache?

The memory-cache npm package is a simple in-memory caching solution for Node.js applications. It allows you to store and retrieve data quickly without the overhead of a database or external caching service. This can be particularly useful for caching frequently accessed data, reducing the load on your primary data sources, and improving application performance.

What are memory-cache's main functionalities?

Set a cache value

This feature allows you to store a value in the cache with a specified key. The value can be any data type, and it will be stored in memory for quick retrieval.

const cache = require('memory-cache');
cache.put('key', 'value');

Get a cache value

This feature allows you to retrieve a value from the cache using its key. If the key exists in the cache, the corresponding value will be returned; otherwise, it will return null.

const cache = require('memory-cache');
const value = cache.get('key');

Delete a cache value

This feature allows you to delete a value from the cache using its key. This can be useful for invalidating cache entries when the underlying data changes.

const cache = require('memory-cache');
cache.del('key');

Set a cache value with expiration

This feature allows you to store a value in the cache with a specified key and an expiration time in milliseconds. After the expiration time, the value will be automatically removed from the cache.

const cache = require('memory-cache');
cache.put('key', 'value', 10000);

Clear the cache

This feature allows you to clear all entries from the cache. This can be useful for resetting the cache or freeing up memory.

const cache = require('memory-cache');
cache.clear();

Other packages similar to memory-cache

Keywords

FAQs

Package last updated on 20 Jun 2017

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