Media Cache Settings

Media Cache Settings

Media Caches

  • Store media for the managed Web site and Sitecore UI tools
  • Uses the file system instead of RAM, due to greater capacity and persistence across system restarts
  • Sitecore manages caches for media and icons separate from all the other Sitecore caches
  • The minimum size and other cache configuration settings do not apply to the media caches
  • Tools that clear other Sitecore caches do not clear the site media caches
  • The media cache and icon cache are also stored separate from each other

Media Cache Management

  • The default location of the Media Cache Folder is /App_Data/MediaCache
  • Media for the Sitecore UI tools are stored under shell
    • Media for the Sitecore user interfaces are cached under/App_Data/MediaCache/shell
    • Delete all the folders under shell to clear the media cache for the Sitecore UI display
  • Media for each Sitecore site are cached under separate folders
    • Media for the Sitecore default site are cached under /App_Data/MediaCache/website
    • Delete all the folders under website to clear the media cache for the default Sitecore site
    • Media items related to additional Sitecore sites are each cached under their site name
  • Icons are cached on the file system under /temp with file names that start with 'icons_'

Media Cache Config Settings

  • Media Cache Folder is the folder where media files are cached by the system
    • The default setting is /App_Data/MediaCache
    • Delete the folders under /App_Data/MediaCache/website to refresh the website display
  • Media Caching Enabled specifies whether caching of media files is enabled. The default setting is true.

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Configuration.Settings.Media
  • Sitecore.Context
  • Sitecore.Data.Items.Item

Configuration Settings




         <setting name="Media.CacheFolder" value="/App_Data/MediaCache" />

         <setting name="Media.CachingEnabled" value="false"/>


C# Web Control Code

Sitecore.Data.Items.Item item = Sitecore.Context.Item;
if (item == null) return;

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold; width:100%; clear:both");
output.Write("C# Web Control Real-time Output");

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-size:x-small; width:100%; clear:both");
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold");
//using &#58; for colon and &#63; for question mark and &#160; for space
output.Write("{0}&#58;&#160;{1}", "Item", item.DisplayName);
output.RenderEndTag(); //P

string mediaCachingEnabled = Sitecore.Configuration.Settings.Media.CachingEnabled.ToString();
string mediaCacheFolder = Sitecore.Configuration.Settings.Media.CacheFolder;

output.Write("{0}&#63;&#160;{1}", "Media Caching Enabled", "<b>" + mediaCachingEnabled + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Media Cache Folder", "<b>" + mediaCacheFolder + "</b>");

output.RenderEndTag(); //Div

Media Cache Settings C# Web Control Output

Media Caching Enabled? True
Media Cache Folder: /App_Data/MediaCache