JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 602
  • Score
    100M100P100Q104994F
  • License MIT

Simple cache config handling for your app or module

Package Exports

  • cache-conf

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cache-conf) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.

set(key, value, [options])

Set an item.

options
maxAge

Type: number

Number of milliseconds the cached value is valid.

isExpired(key)

Boolean indicating if the cached data is expired.

  • conf - Simple config handling for your app or module

License

MIT © Sam Verschueren