Caching library with LevelDB backend and english-time enabled interface.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
.npmignore
README.md
index.js
package.json
test.js

README.md

level-json-cache

Caching library with LevelDB backend and english-time enabled interface.

cache = require('level-json-cache')('foobar')

cache.set('foo', { span: 'eggs', 'bar': 314 }, '5 days', function (error) {
  if (error) throw error;

  cache.get('foo', function (error, foo) {
    if (error) throw error;

    console.log('foo in cache:', foo)
  })
})

Example Time Inputs:

  • 1000
  • 1 week 3 days
  • 1 hour, 5 minutes and 15 seconds

Full Reference: english-time

Install

$ npm install level-cache

Unlimited Caching

Pass -1 or 'never' to not define any expiration.

Manually Invalidating

cache.invalidate('whatever', function (){
  // done
});

Destroying

cache.destroy(function () {
  // done
});