UNPKG

502 BJavaScriptView Raw
1/**
2 * Get cache object by `name`.
3 *
4 * @param {String|Function} name
5 * @param {Object} options
6 * @return {Object}
7 * @api private
8 */
9
10var getCache = module.exports = function(name, options){
11 if ('function' == typeof name) return new name(options);
12
13 var cache;
14 switch (name){
15 // case 'fs':
16 // cache = require('./fs')
17 // break;
18 case 'memory':
19 cache = require('./memory');
20 break;
21 default:
22 cache = require('./null');
23 }
24 return new cache(options);
25};