Antaris/RazorEngine

Razor.Parse with Caching does not work on Production

Opened this issue · 1 comments

PvAsh commented

Hi I am using below code. to convert the template. I have around 100 templates and wan to cache them. it works absolutely fine on my Dev but does not work on production. For the same cacheSring I takes alomost 6000 ms to load the template and parse it. Any help would greatly appreciate.

Stopwatch sw = new Stopwatch();
sw.Start();
if (templateTypeId > -1)
{
string cacheString = templateTypeId.ToString();
Audit.Logging.Log("**Cache hit!! Template : "+templateTypeId + ". Method is " + MethodBase.GetCurrentMethod().Name,null,"Dep Log");
document = RazorEngine.Razor.Parse(template, model, cacheString);
}
else
{
Audit.Logging.Log("**No Cache hit!! Template : " + templateTypeId + ". Method is " + MethodBase.GetCurrentMethod().Name, null, "Dep Log");
document = Razor.Parse(template, model);
}
sw.Stop();

            Audit.Logging.Log("**Generating Template : Time taken" + sw.Elapsed.TotalMilliseconds + " milliseconds. Method is " + MethodBase.GetCurrentMethod().Name, null, "Dep Log");
            // no exception - no errors!
            errors = string.Empty;
PvAsh commented

Just to add I am using region Assembly RazorEngine.dll, v3.2.0.0