Last change
on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
502 bytes
|
Rev | Line | |
---|
[6a3a178] | 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 |
|
---|
| 10 | var 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 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.