Thursday, February 9, 2012

Sitecore Fetch Squad

Automated crawler fetching websites and blogs from Sitecore content

Cache sizes

Crawled: On December - 29 - 2008 Source

In Sitecore 5.1 we go from having one large cache (mapping to the ASP.NET cache) to using multiple custom caches.

The caches are all accessed through a common class, the CacheManager. This class has a lot of methods used for adding/removing data and performing other cache related functions.

Database caches

The credential cache stores information about user rights. For instance, when it has been determined that a specific user can or can not read a given item, this information is stored in the credential cache. Subsequent read requests can then be granted without requiring a full security scan for the user again.

The data cache stores data read from the data provider(s). The data is stored in a format that makes it very fast to access. Specifically, the cache contains objects of the type DataManager.DataContainer.

The path mapping cache stores information about previously resolved paths. For instance, if the system has already determined that the path "/sitecore/content/home" maps to the ID {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} it stores this information. The next time someone requests an item using the same path, the item can be retrieved very fast using the cached ID.

Site caches

The html cache stores the html output of renderings that have been set to Cacheable.

The xsl cache is used for storing compiled XSLT files in memory. This relieves the system from the need to recompile the XSLT’s every time they are needed. Also, it helps keep memory consumption down when using inline code in XSLT’s (as these can not be unloaded due to a limitation in .Net).

The registry cache is used by the Sitecore Client to store various user settings and would not normally be used by other applications.

The viewState cache is also an interal cache used by the Sitecore Client.

Cache sizes

Cache sizes can be set up either on a specific site or database definition or it can be specified in the <cacheSizes> section. The values set directly on a site or a database will always take precedence over the values set in <cacheSizes>.

The <cacheSizes> section should pretty much be self-explanatory. An example is shown below.

    <cacheSizes>
      <databases>
        <core>
          <data>10MB</data>
          <credential>1MB</credential>
          <pathMapping>1MB</pathMapping>
        </core>
      </databases>
      <sites>
        <core>
          <html>0</html>
          <registry>10MB</registry>
          <viewState>0</viewState>
          <xsl>0</xsl>
        </core>
        <website>
          <html>10MB</html>
          <registry>0</registry>
          <viewState>0</viewState>
          <xsl>5MB</xsl>
        </website>
      </sites>
    </cacheSizes>

The valid cache names for the <databases> element are:

  data
  credential
  pathMapping

The valid cache names for the <sites> element are:

  html
  registry
  viewstate
  xsl

To set a cache size directly on a site, use an attribute named xxxCacheSize where xxx is the name of the cache. For instance, to set the size of the html cache on the web site use:

  <site name="website"
    …
    htmlCache="10MB" />

The size can be specified in bytes (no postfix), kilobytes (KB) or megabytes (MB). Spaces and dots are allowed in the value string, so the following is also valid:

  <site name="website"
    …
    htmlCache="1.024 KB" />

To set a cache size directly on a database, you must use the properties on the database object (as the database object is constructed by Sitecore.Factory using only reflection).

To set the size of the data cache on the "master" database you can use:

  <database id="master" …>
    …
    <caches.DataCache.MaxSize>1000000</caches.DataCache.MaxSize>
  </database>

Note that the size must be specified in bytes (as the type of the MaxSize property is long).

Disable caching

By settting a size of 0 (zero) on a cache, the cache in question will be disabled. For instance, to disable html caching on the web site:

  <site name="website"
    …
    htmlCache="0" />

To disable all caching whatsoever in the system, the global setting "Caching.Enabled" can be used like this:

  <setting name="Caching.Enabled" value="false" />

This setting is mostly for diagnostic purposes.

As a side note, individual data providers may also prevent their data from being cached by using the CacheOptions property on the DataProvider base class. For an example of this, see the file system data provider, which is defined like this in web.config:

      <filesystem
            type="Sitecore.Data.DataProviders.FileSystemDataProvider,
            Sitecore.Kernel">
        <CacheOptions.DisableAll>true</CacheOptions.DisableAll>
      </filesystem>

 

 

 

Sitecore API

Comments are closed.

Sitecore Lucene index does not remove old data

Posted by admin
Oct-30-2011 I Comments Off

Teach User Manager how to search by email

Posted by admin
Oct-30-2011 I Comments Off

Language filtered Multilist field

Posted by admin
Oct-30-2011 I Comments Off