cacha
My hunky-dory module
Last updated 9 years ago by floatdrop .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install cacha 
SYNC missed versions from official npm registry.

cacha Build Status

Cache on file-system

Install

$ npm install --save cacha

Usage

const Cache = require('cacha');
const cache = new Cacha('.my/cache');

cache.set('id', 'content');
//=> Promise

cache.get('id');
//=> Promise with 'content'

API

cacha(namespace, [options])

namespace

Type: string

Directory in HOME or TMP directory of current user.

If namespace begins with / it will be interpreted as absolute path.

options

ttl

Type: Number
Default: 86400000

How long (in milliseconds) keep entries in cache.

cache.get(id, [options])

cache.getSync(id, [options])

cache.set(id, content, [options])

cache.setSync(id, content, [options])

Get and set methods for cache entries. options are passed to fs write and read methods (for example to specify encoding).

cache.clean()

Removes outdated entries in cache.

License

MIT © Vsevolod Strukchinsky

Current Tags

  • 1.0.3                                ...           latest (9 years ago)

4 Versions

  • 1.0.3                                ...           9 years ago
  • 1.0.2                                ...           9 years ago
  • 1.0.1                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Total 3
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (3)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE