How to use the moleculer.Cachers function in moleculer

To help you get started, we’ve selected a few moleculer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github icebob / vue-express-mongo-boilerplate / server / core / broker.js View on Github external
let	path 			= require("path");
let	fs 				= require("fs");
let _ 				= require("lodash");
let chalk 			= require("chalk");

let Moleculer     	= require("moleculer");
let APIService     	= require("./api-service");

/* global WEBPACK_BUNDLE */
if (!WEBPACK_BUNDLE) require("require-webpack-compat")(module, require);

// Create cache module
let cacher;
if (config.cacheTimeout > 0) {
	cacher = new Moleculer.Cachers.Memory({
		ttl: config.cacheTimeout
	});
}

// Create service broker
let broker = new Moleculer.ServiceBroker({
	cacher,
	logger,
	logLevel: "debug",
	nodeID: config.nodeID,
	metrics: true,
	statistics: false,
	ServiceFactory: APIService
});

// Load services