I am using the Asp.net OutputCache on a page containing a usercontrol that in certain circumstances when the usercontrol is edited i want to be able to expire the page cache and reload the page with fresh data.
Is there any way i can do this from within the usercontrol?
If not, what are some other methods of caching the page that will allow me to edit in this way.
———– EDIT ———–
After some more research I found a method that seems to work well.
Dim cachekey As String = String.Format("Calendar-{0}", calendarID)
HttpContext.Current.Cache.Insert(cachekey, DateTime.Now, Nothing, System.DateTime.MaxValue, System.TimeSpan.Zero, System.Web.Caching.CacheItemPriority.NotRemovable, Nothing)
Response.AddCacheItemDependency(cachekey)
that will add a dependency to the page cache object, then to expire I do this:
Dim cachekey as string = String.Format("Calendar-{0}", CalendarID)
HttpContext.Current.Cache.Insert(cachekey, DateTime.Now, Nothing, System.DateTime.MaxValue, System.TimeSpan.Zero, System.Web.Caching.CacheItemPriority.NotRemovable, Nothing)
Now as long as the dependency cachekey is known a page can be expired.
After some more research I found a method that seems to work well.
that will add a dependency to the page cache object, then to expire I do this:
Now as long as the dependency cachekey is known a page can be expired.