Coder Social home page Coder Social logo

lru-cache-fs's Introduction

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

lru-cache-fs's People

Contributors

ruyadorno avatar

Stargazers

Roman avatar aric avatar Jefferson Follmann avatar Ariel dos Santos Nunes avatar Guilherme Mota avatar Erick Wendel avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.