I have a MVC3 application that is serving views stored in a database. I created a VirtualPathProvider
and in my GetFile
and FileExists
methods I go to the database and return the correct thing. So far so good.
Now I want to cache the view I return from GetFile
. I understand MVC already does some view caching and we have some control with it via GetCacheDependency
method. But do we have more control than this? For example, can we use a custom cache there? In my case, I'm interested in caching the views on local filesystem and do my own cache invalidation.
An easy way would be to do it myself in my GetFile
method, but if there's a natural extensibility point for this in MVC I would rather use it instead.
Thanks
I was looking at something, noticed your question, has not been answered. You would need to override GetFileHash()
along with GetCacheDependency()
. Then you would need to implement your own CacheDependency to invalidate the ASP.NET Cache.