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

cache-manager-redis-yet

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-manager-redis-yet

Redis store for node-cache-manager updated

  • 5.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is cache-manager-redis-yet?

The cache-manager-redis-yet package is a Redis store for the cache-manager module, which allows you to use Redis as a caching layer in your Node.js applications. It provides functionalities for setting, getting, and managing cache entries in a Redis database.

What are cache-manager-redis-yet's main functionalities?

Setting a Cache Value

This feature allows you to set a value in the Redis cache with a specified time-to-live (TTL). The code sample demonstrates how to set up the cache manager with the Redis store and set a cache value.

const cacheManager = require('cache-manager');
const redisStore = require('cache-manager-redis-yet');

const cache = cacheManager.caching({
  store: redisStore,
  host: 'localhost',
  port: 6379,
  ttl: 600
});

cache.set('foo', 'bar', { ttl: 10 }, (err) => {
  if (err) throw err;
  console.log('Value set');
});

Getting a Cache Value

This feature allows you to retrieve a value from the Redis cache. The code sample shows how to get a previously set cache value.

cache.get('foo', (err, result) => {
  if (err) throw err;
  console.log(result); // 'bar'
});

Deleting a Cache Value

This feature allows you to delete a value from the Redis cache. The code sample demonstrates how to delete a cache entry.

cache.del('foo', (err) => {
  if (err) throw err;
  console.log('Value deleted');
});

Wrapping a Function

This feature allows you to wrap a function so that its result is cached. The code sample demonstrates how to wrap a function that simulates a long-running operation.

cache.wrap('foo', (cb) => {
  // Simulate a long-running operation
  setTimeout(() => {
    cb(null, 'bar');
  }, 2000);
}, (err, result) => {
  if (err) throw err;
  console.log(result); // 'bar'
});

Other packages similar to cache-manager-redis-yet

Keywords

FAQs

Package last updated on 23 Sep 2024

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