Socket
Book a DemoInstallSign in
Socket

lruly

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lruly

lruly implements an LRU cache.

latest
Source
npmnpm
Version
0.0.8
Version published
Maintainers
1
Created
Source

lruly

Implements an LRU cache.

var lruly = require('lruly');

var cache = lruly();
cache.add('foo', 'hello world');

Installation

$ npm install -g lruly

$ component install cfddream/lruly

Quick Start

Create the LRU cache and set maxEntries, if maxEntries is zero, the cache has no limit:

var cache = lruly(8964);

Add a entiry:

cache.add('module', { version: '0.0.1', name: 'lruly' });

Get the entry's value:

cache.get('module'); // { version: '0.0.1', name: 'lruly' }

Remove the entry by key:

cache.on('evicted', function (key, value) { /* do something */ });

cache.remove('module');

Get the number of entries in the cache:

cache.len();

Clean the cache:

cache.clean();

Running Tests

To run the test suite first invoke the following command within the repo, installing the development dependencies:

$ npm install

then run the tests:

$ make test

MIT License

Keywords

lru

FAQs

Package last updated on 12 Aug 2013

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.