index.js 502 B

12345678910111213141516171819202122232425
  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. var getCache = module.exports = function(name, options){
  10. if ('function' == typeof name) return new name(options);
  11. var cache;
  12. switch (name){
  13. // case 'fs':
  14. // cache = require('./fs')
  15. // break;
  16. case 'memory':
  17. cache = require('./memory');
  18. break;
  19. default:
  20. cache = require('./null');
  21. }
  22. return new cache(options);
  23. };