The object cache functionality in EPiServer is pretty easy to use, but there are some cases you have to consider before using it.
EPiServer extensions for the output cache - How the ASP.NET output cache is used in EPiServer.
Usage
// Add a string to the cache on the local server
EPiServer.CaheManager.Add(“MyCacheKeyForThisObject”, “CachedString”);
// Get a cached string from the local server
String cachedString = EPiServer.CahceManager.Get(“MyCacheKeyForThisObject”) as string;
// Remove the cached object on all machines
EPiServer.CaheManager.Remove(“MyCacheKeyForThisObject”, “CachedString”);
Remarks
The EPiServer.CaheManager is not synchronizing between machines and is dependent that you have some transaction handling (ex. a database) for the objects.
The method EPiServer.CaheManager.RuntimeCache is only refereeing to the runtime cache on the local machine and don’t send events to other machines.
For page providers the PageData cache time is set on the remotePageCacheSlidingExpiration attribute (not by pageCacheSlidingExpiration as normal PageData objects uses) in the EPiServer section.
IMPORTANT!
DataFactory.DeleteChildren cleans the whole PageData cache!