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

cache-conf

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-conf

Simple cache config handling for your app or module

  • 0.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
190
decreased by-24.3%
Maintainers
2
Weekly downloads
 
Created
Source

cache-conf Build Status

Simple cache config handling for your app or module

If you don't need caching, you should use conf instead. This module extends that module and abstracts away the caching mechanism.

Install

$ npm install --save cache-conf

Usage

const delay = require('delay');
const CacheConf = require('cache-conf');
const config = new CacheConf();

config.set('unicorn', '🦄', {maxAge: 5000});
console.log(config.get('unicorn'));
//=> '🦄'

// Wait 5 seconds
await delay(5000);

console.log(config.get('unicorn'));
//=> undefined

API

CacheConf([options])

Returns a new instance.

options

Any of the conf options.

Instance

An extended conf instance.

get(key, [options])

Get an item.

options
ignoreMaxAge

Type: boolean
Default: false

Get the item for the key provided without taking the maxAge of the item into account.

set(key, value, [options])

Set an item.

set(object, [options])

Set multiple items at once.

options
maxAge

Type: number

Number of milliseconds the cached value is valid.

version

Type: string

Version number of the data. If the version provided is not the same as the version of the cached data, the data will be invalid.

isExpired(key)

Boolean indicating if the cached data is expired.

  • conf - Simple config handling for your app or module
  • observable-conf - Listen for changes in your conf config

License

MIT © Sam Verschueren

Keywords

FAQs

Package last updated on 14 Sep 2017

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