RazorEngine
RazorEngine copied to clipboard
Redis support
Hi, Is it possible to add redis cache support for the template caching?
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.
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());