1.0.11 • Published 3 years ago

softweb-cacher v1.0.11

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Cacher

cacher is a node module used for caching object into json files.

Instalation

Use the package manager npm to install generator.

npm install softweb-logger

Usage

Require

const Cacher = require("softweb-cacher");

Create Object

  • @params {string} params String to convert to md5 hash
const Cacher = require("softweb-cacher");
const cacher = new Cacher("test");

checkCache() : Boolean

  • @returns {Boolean} whether the json object with the md5 key exists
const Cacher = require("softweb-cacher");
const cacher = new Cacher("test");
cacher.checkCache();

retrieveData() : String

  • @return Json object stringified
const Cacher = require("softweb-cacher");
const cacher = new Cacher("test");
if(cacher.checkCache()){
    let data = JSON.parse(cacher.retriveData());
}

storeData(data) : Void

  • @param data Json object
  • @summary Stores the data to a json object
const Cacher = require("softweb-cacher");
const cacher = new Cacher("test");
const data = {
    test : "test"
};
if(!cacher.checkCache()){
    cacher.storeData(data);
}

static deCach() : Void

  • @param {Number} days
  • @summary clears from cache any file thats days old
const Cacher = require("softweb-cacher");
Cacher.deCach();
1.0.11

3 years ago

1.0.1

3 years ago