forked from cliftonc/calipso
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCache.js
42 lines (37 loc) · 948 Bytes
/
Cache.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*!
* Calipso Core Caching Library
*
* Copyright(c) 2011 Clifton Cunningham <[email protected]>
* MIT Licensed
*
* This is the core Calipso library that enables caching to be turned on
* that will cache both module and full page output.
*
* The idea is to have a pluggable cache storage module, copied liberally
* from concepts behind the express session module.
*
*
*
*/
var MemoryStore = require('./cache/memory')
, Store = require('./cache/store');
// Exports
exports.cache = cache;
exports.Store = Store;
exports.MemoryStore = MemoryStore;
/**
* Very simple wrapper that
* Enables pluggability of cache store, defaulting to in Memory
*
* cache.set('cc','RAH!',500,function() {
* cache.get('cc',function(err,item) {
* console.log(item);
* });
* });
*
*/
function cache(options){
var options = options || {},
store = store || new MemoryStore(options);
return store;
}