RazorEngine icon indicating copy to clipboard operation
RazorEngine copied to clipboard

Redis support

Open arnoldsimha opened this issue 9 years ago • 2 comments

Hi, Is it possible to add redis cache support for the template caching?

arnoldsimha avatar Jan 06 '16 22:01 arnoldsimha

Do my comments here help? I don't think we should add redis support to this repo. But a RazorEngine.Redis package would probably make perfect sense.

matthid avatar Jan 20 '16 17:01 matthid

Hi,

Is there any plan to support redis in recent future?

We are using Razorengine service in web api. For every user request, we re-initialize razor engine service and compiles template again. It takes approx. 2.5 seconds for three different compilation in parallel. We also tried to use 'IsTemplateCached' method to optimize performance. However, it does not help in case of multiple servers scenario (invalidation is a problem).

Is there any way to optimize or improve performance using below sample?

		var config = new TemplateServiceConfiguration();
		var service = RazorEngineService.Create(config);
		List<Task> compilationTasks = new List<Task>();

		compilationTasks.Add(Task.Run(() => service.Compile("HTML Content", "templateHTMLKey", null)));
		compilationTasks.Add(Task.Run(() => service.Compile("Plain text content", "templateTextKey", null)));
		compilationTasks.Add(Task.Run(() => service.Compile("Subject content", "templateSubjectKey", null)));

		await Task.WhenAll(compilationTasks.ToArray());

mbpnet avatar Feb 08 '18 13:02 mbpnet