bc

bauer-cache

Disk-cache library.

Showing:

Popularity

Downloads/wk

4

GitHub Stars

0

Maintenance

Last Commit

6yrs ago

Contributors

1

Package

Dependencies

2

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

bauer-cache

Disk-cache library.

Installation

npm install bauer-cache

Usage

var Cache = require("bauer-cache");

var myCache = new Cache({
  file: {
    dir: "./cache",
    name: "filename",
    ext: "json"
  },
  expires: "1d",
  json: true
});

myCache.validate(function(error,isValid) {
  
  if (isValid) {
    
    myCache.read(function(error,data) {
      
    });
    
  } else {
    
    myCache.write({ hello: "world" },function(error) {
      
    });
    
  }
});

API Summary

  • Cache
    • new Cache(options Object) :Cache
    • .setMakeDir(mkdir Boolean) :void
    • .getMakeDir() :Boolean
    • .setJSON(json Boolean) :void
    • .isJSON() :Boolean
    • .parseJSON(content String, callback Function) :void
    • .setFile(options Object) :void
    • .setFile(file String) :void
    • .getFile() :String
    • .setExpiration(time Number) :void
    • .setExpiration(expires String) :void
    • .getExpiration() :Number
    • .read() :Readable
    • .read(callback Function) :void
    • .write() :Writable
    • .write(object Array, callback Function) :void
    • .write(object Object, callback Function) :void
    • .write(content String, callback Function) :void
    • .remove(callback Function) :void
    • .exists(callback Function) :void
    • .expired(callback Function) :void
    • .validate(callback Function) :void

License

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial