Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

themass/Node-Simple-Cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

19 Commits

Repository files navigation

#How to use

##Init

Cache.createCache([cache algorithm], [cache size])

  • About cache algorithm: you have two choice "LRU" or "LFU", of course you can add your own algorithm. If you not sure which algorithm, you can choose the following manage mode.
var cache = require("Cache");
Cache.createCache("LRU", 100 * 100 * 10);

##Set

cache.set(key, value[, expire(millisecond)])

cache.set("key", "value", 1000 * 60);

##Get

cache.get(key)

cache.get("key") // value or null

##Clear

cache.clear()

##Manage Mode

If you are not sure which cache replacement algorithm is you need, you can try this model, it will caculate the recently 100 * 100 * 3 get hit rate in different algorithm.And according the hit rate choose the higher algorithm one:

var CacheManage = require("./Manage");
CacheManage.set("key", "value", 1000 * 60);

About

A simple node.js cache manage system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /