🚀 Launch Week Day 5:Introducing Immutable Scans.Learn More →
Socket
Book a DemoInstallSign in
Socket

lru-cache-fs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lru-cache-fs

Extends lru-cache to add file system support

latest
Source
npmnpm
Version
2.0.1
Version published
Weekly downloads
7.2K
1.01%
Maintainers
1
Weekly downloads
 
Created
Source

lru-cache-fs

NPM version Build Status MIT license

Extends lru-cache to add file system support.

Install

npm install lru-cache-fs

Usage

Retrieve cache:

const Cache = require('lru-cache-fs')

const cache = new Cache({
	max: 100,
	cacheName: "cache" // filename ref to be used
});

By default it will use os specific paths, using env-paths.

Then retrieve/set items using:

cache.get('some-item') // returns whatever was stored
cache.set('some-new-item', 'foo') // sets new item and stores cache sync to fs

The fsDump() method exposes an API that allows you to persist the current cache on your file system:

cache.fsDump()

All other methods from lru-cache should be available, e.g:

cache.dump() // retrieves dump of current cache memory

License

MIT © 2019 Ruy Adorno

Keywords

cache

FAQs

Package last updated on 23 Nov 2019

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