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

cachu

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cachu

A simple key-value cache for Node.js.

  • 6.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

cachu

Setup

# Get the latest release.
npm i cachu

Usage

Note - Need an introduction to v6? Here you go!

import { useCache } from 'cachu'

const cache = useCache({
  maxAge: '10m', // 10 minutes, can be specified as number (in seconds) or readable string
  ...
})

// Add a new entry.
await cache.add('one', 'Hello World')
  
const entry = await cache.get('one') // 'Hello World'

API

  • Configuration (optional)
    • maxAge to set the maximum age for each record in the cache (defaults to 600s)
    • maxAmount to set the maximum size for the cache (defaults to 10000)
    • autodelete to delete overaged entries on adding/updating (disabled by default)
  • Features
    • add()
    • addMany()
    • get()
    • getMany()
    • update()
    • updateMany()
    • remove()
    • removeMany()
    • has()
    • size() (get the cache size in bytes)
    • keys()
    • values()
    • clear() (delete all overaged entries manually)

FAQs

Package last updated on 20 Aug 2022

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