There are Many ways to configure Caching in Sitecore. Here is the four major caching concepts in Sitecore.
- HTML Caching
- Item Cache
- Data Cache
- Prefetch Cache
We can configure caching settings in separate config file under app_config or directly add to web.config (Remember, there is only one config file for site at run-time and all config files will be merged)
Add below configurations in your .config file if required!
To clear your install cache
1) HTML Cache
It caches actual HTML output generated from rendering and sublayout.
It can be configured from caching section of rendering controls.
Each website can be configured to enable or disable HTML cache along with allowed HTML cache size in web.config file under <sites> section.
<site name = “website” virtualFolder=”/” physicalFolder=”/” rootPath=”/sitecore/content ” startItem=”/Home” database=”web” domain=”extranet” cacheHtml=”true” htmlCacheSize=”10MB” enablePreview=”true” enableWebEdit=”true” enableDebugger=”true” disableClientData=”false” />
2) Item Cache
Sitecore items are cached under this cache layer. This cache contains objects of the Sitecore class Sitecore.Data.Items.Item, which are the one you use in your code most of the time.
Whenever any sitecore item is requested, it will be served from item cache and if it is not there then it will be served from data cache (next layer of cache) and will populate cache in item cache layer. So that whenever next request for same item is made, it will be directly served from item cache.
3) Data Cache
Data cache contains items of the Sitecore class ItemInformation. Whenever any request is made, data is pulled from data cache. But if it is not present there it will be pulled from prefetch cache and then will be put into data cache. So that whenever next request for same item is made, it will be directly served from data cache.
Data cache can be configured in web.config file under Caching.DefaultDataCacheSize setting:
<setting name = “Caching.DefaultDataCacheSize” value=”10MB” />
4) Prefetch Cache
There is prefetch cache for each database. The cache contains items of Sitecore class PrefetchData which is same like data pulled from database. Prefetch cache load the cache at Sitecore start up as per specified in App_Config/Prefetch folder.
Note: HTML caching can causes serious issues if you use rendering control repeatedly on same page (one component can be rendered multiple times)