src/cachers/index.js
function resolve(opt) {
	if (opt instanceof Cachers.Base) {
		return opt;
	} else if (opt === true) {
		return new Cachers.Memory();
	} else if (_.isString(opt)) {
		let CacherClass = getByName(opt);
		if (CacherClass)
			return new CacherClass();

		if (opt.startsWith("redis://"))
			CacherClass = Cachers.Redis;

		if (CacherClass)
			return new CacherClass(opt);
		else
			throw new BrokerOptionsError(`Invalid cacher type '${opt}'.`, { type: opt });

	} else if (_.isObject(opt)) {
		let CacherClass = getByName(opt.type || "Memory");
		if (CacherClass)
			return new CacherClass(opt.options);
		else
			throw new BrokerOptionsError(`Invalid cacher type '${opt.type}'.`, { type: opt.type });
	}

	return null;
}
function resolve(opt) {
	if (opt instanceof Cachers.Base) {
		return opt;
	} else if (opt === true) {
		return new Cachers.Memory();
	} else if (_.isString(opt)) {
		let CacherClass = getByName(opt);
		if (CacherClass)
			return new CacherClass();

		if (opt.startsWith("redis://"))
			CacherClass = Cachers.Redis;

		if (CacherClass)
			return new CacherClass(opt);
		else
			throw new BrokerOptionsError(`Invalid cacher type '${opt}'.`, { type: opt });

	} else if (_.isObject(opt)) {
		let CacherClass = getByName(opt.type || "Memory");
		if (CacherClass)
			return new CacherClass(opt.options);
		else
			throw new BrokerOptionsError(`Invalid cacher type '${opt.type}'.`, { type: opt.type });
	}

	return null;
}
function resolve ( opt ) { if ( opt instanceof Cachers . Base ) { return opt ; } else if ( opt === true ) { return new Cachers . Memory ( ) ; } else if ( _ . isString ( opt ) ) { let CacherClass = getByName ( opt ) ; if ( CacherClass ) return new CacherClass ( ) ; if ( opt . startsWith ( "redis://" ) ) CacherClass = Cachers . Redis ; if ( CacherClass ) return new CacherClass ( opt ) ; else throw new BrokerOptionsError ( ` ${ opt } ` , { type : opt } ) ; } else if ( _ . isObject ( opt ) ) { let CacherClass = getByName ( opt . type || "Memory" ) ; if ( CacherClass ) return new CacherClass ( opt . options ) ; else throw new BrokerOptionsError ( ` ${ opt . type } ` , { type : opt . type } ) ; } return null ; }
Resolve cacher by name

@param {object|string} opt
@returns {Cacher}
Resolve cacher by name