Skip to content

KCreate/kcache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kcache

Small caching api for node. Can also be used in the browser.

Installation

Download via GitHub or NPM

npm install kcache

Initialize like this:

var cache = Kcache();

You can then set, get, observe and print out the data as json using these methods:

set

cache.set("yourKey", "yourValue", function (oldValue, newValue) { //yourCallback });

the callback (last parameter) is optional, so you don't have to provide one if you don't need to.

get

cache.get("yourKey");

This returns an object that looks like that:

{
	data: "yourValue",
	timestamp: 123456789
}

observe

cache.setNotifier("yourKey", function(oldValue, newValue) { //yourCallback });

You can also set a callback while setting a property value, by providing the callback as a third parameter in the set method.

print JSON

You can either get the json for only one item or the whole thing.

cache.getJSON("yourKey");
acache.getJSON();

About

Small caching api for node. Can also be used in the browser.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published