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
I would like to remove a page from the output cache from a controller after a db update but I could not find a way to make this work. The cache key is hard to construct outside the controller that contains the action filter that added the cache item.
The text was updated successfully, but these errors were encountered:
Let's see if I can find an elegant way to invalidate pages. For now a quick intro on the cache key. It's in MothAction.cs. The cache key consists of min. 2 items:
Controller name
Action name
Hashcodes of Parameter values
The action HomeController.Index(int pageId, string something) where pageId = 3 and something = "hi" will be constructed as:
var items = new List<string>();
items.Add("Home");
items.Add("Index");
items.Add(3.GetHashCode());
items.Add("hi".GetHashCode());
var key = string.Join("|", items.ToArray());
You can delete this item from the cache via:
new AspNetCacheProvider().Store(key, null, new TimeSpan(0, 0, 1));
I would like to remove a page from the output cache from a controller after a db update but I could not find a way to make this work. The cache key is hard to construct outside the controller that contains the action filter that added the cache item.
The text was updated successfully, but these errors were encountered: