jcache

0.0.1 • Public • Published

Jcache

Jcache is a node.js library for caching.

Installation

You can install Jcache with the npm:

npm install jcache

Functions

add(key, data)

Add new data to cache

Arguments

  • key - Key (ID) for access to cached data.
  • data - Value for caching.

Example

// Add data "10" with key "5+5" to cache
var jcache = require('jcache');
jcache.add("5+5", 10);

get(key)

Get data from cache.

Arguments

  • key - Key (ID) for access to cached data.

Example

// Get data with id "5+5" from cache
var jcache = require('jcache');
jcache.get("5+5"); // Should return 10 if using with above example.

exists(key)

Check that data with key exists in cache

Arguments

  • key - Key (ID) for access to cached data.

Example

// Check that data with key "5+5" exists in cache
var jcache = require('jcache');
jcache.exists("5+5"); // Should return true if using with above examples.

remove(key)

Remove data with key

Arguments

  • key - Key (ID) for access to cached data.

Example

// Remove data with key "5+5"
var jcache = require('jcache');
jcache.remove("5+5");

Readme

Keywords

none

Package Sidebar

Install

npm i jcache

Weekly Downloads

42

Version

0.0.1

License

MIT

Last publish

Collaborators

  • exwei