//Adds the specified content to the cache with the specified key, if it's enabled //Content is stored in a single object and not separately because the "Special CacheDependencies" can't be used more than once private void AddContentToCache(string content, CachedContentType ccType) { //and assign property depending on content type switch (ccType) { case CachedContentType.FinalHtml: this.CachedContentItem.FinalHTML = content; break; case CachedContentType.RawHtml: this.CachedContentItem.RawHTML = content; break; } }
//Gets value from the cache if available private string GetContentFromCache(CachedContentType ccType) { //NOTE to self: It doesn't check if caching is enabled because I want the setting to be available in the front-matter too //and, at the point this method is called, the FM is not usually available yet, and I want to avoid reading the file //on each request (that's the main purpose of caching here). //The original version of MIIS only allowed this setting to be global, in the web.config for the same reason. switch (ccType) { case CachedContentType.FinalHtml: return(this.CachedContentItem.FinalHTML); case CachedContentType.RawHtml: return(this.CachedContentItem.RawHTML); default: return(""); } }