You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today what I'm doing is invalidating all cached templates by just creating another instance of RazorEngineService. By I don't know how this will affect memory usage, because the previously cached templates probably will remain in memory.
Any ideas ?
The text was updated successfully, but these errors were encountered:
There in no way to do that with the default configuration and there is a good reason why. But first to your problem: The way to do what you want to do is to implement a custom ITemplateManager and a custom ICachingProvider, depending on your needs that will simplify your code to
When your template source changes the TemplateManager should notify the CachingProvider and invalidate the cache.
But now a warning to the memory usage: You will never get your memory back this way. There is no way to implement a CachingProvider which gives you back the memory, because templates are basically loaded assemblies. And as you might know there is no way to unload loaded assemblies.
So if you need unloading templates very often you should use Isolation and a custom logic for re-use (for example unload the domain, if you have 100 stale assemblies or something like that)
There is also a quick-fix posted here, but I don't recommend using it (see my post below).
It would be useful if we could just remove an item from the cache.
Today what I'm doing is invalidating all cached templates by just creating another instance of RazorEngineService. By I don't know how this will affect memory usage, because the previously cached templates probably will remain in memory.
Any ideas ?
The text was updated successfully, but these errors were encountered: