Vulnerability in EPiServer.Forms
In a load-balanced environment, is it possible to hook into the cache invalidation? When a page changes on Server A, it broadcasts across UDP 455 to tell Server B (and C, and D...) to invalidate cache for that page.
I'd like to hook this event. We're doing significant output caching, and I'd like the other servers to clear some output cache items at the same they invalidate the page cache.
Is this possible?
Yes indeed. Load balancing is done using the EPiServer Events System (there is a technote if you want to learn more).
You just need to find out the Guid of the event you're interested in (ok, not that easy) and then you're done. In your case you probably want to handle the CMS Page Cache Remove event 9484E34B-B419-4e59-8FD5-3277668A7FCE.
Add a reference to the EPiServer.Events assembly. This is part of CMS in CMS 5 and EPiServer Framework in CMS 6. Also add a reference to EPiServer.dll so you can use the constants from the CacheManager class.
In you code:
Event removeFromCacheEvent = Event.Get(CacheManager.RemoveFromCacheEventId);
removeFromCacheEvent.Raised += new EventNotificationHandler(RemoveFromCacheEvent_Raised);
private static void RemoveFromCacheEvent_Raised(object sender, EventNotificationEventArgs e)
// if you don't want process events raised on this machine
// then check the raiser id
if (e.RaiserId != CacheManager.LocalCacheManagerRaiserId)
// Do custom processing here...
Hope this helps!