Standard Values Cache

Standard Values Cache

Standard Values Cache

  • A type of database caching unrelated to the Site caches
  • Assigned under a specific database in the web.config file
  • Used to store the Standard Values for data templates in the database
  • Does not depend on any other caches
  • DBName in the path section can be "web", "master", "core" or "filesystem"
  • <standardvalues> in the path specifies the Standard Values cache size for the database

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Configuration.Settings.Caching
  • Sitecore.Configuration.Settings.Caching.StandardValues
  • Sitecore.Data.Items.Item

Standard Values Cache Configuration Setting

Database Setting

  • <configuration>
    • <sitecore>
      • <databases>
        • <database id="DBName" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel">
          • <cacheSizes hint="setting">
            • <standardvalues>500KB</standardvalues>

 

Default Setting

  • <configuration>
    • <sitecore>
      • <settings>
        • <setting name="Caching.StandardValues.DefaultCacheSize" value="1MB"/>

Standard Values Cache C# Web Control Code

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

string cachingEnabled = Sitecore.Configuration.Settings.Caching.Enabled.ToString();
string defaultCacheSize = Sitecore.Configuration.Settings.Caching.StandardValues.DefaultCacheSize.ToString();
string averageValueSize = Sitecore.Configuration.Settings.Caching.StandardValues.AverageValueSize.ToString();

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

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-size:x-small; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.P);
//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

output.Write("{0}&#63;&#160;{1}", "Caching Enabled", "<b>" + cachingEnabled, "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Default Standard Values Cache Size", "<b>" + defaultCacheSize, "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Average Standard Values Size", "<b>" + averageValueSize, "</b>");

output.RenderEndTag(); //Div

Standard Values Cache C# Web Control Output

Item: Standard Values Cache

Caching Enabled? True

Default Standard Values Cache Size: 1048576

Average Standard Values Size: 100

Sources