How to check if data cache and presentation cache are enabled or not in Sitecore?
I have received the feedback to enable Sitecore OOTB data and presentation cache.
How to check above settings?
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.
Sign up to join this communityOn https://XXXXXXX/sitecore/admin/cache.aspx page, you can find all the cache details. Below types of cache
you can setup
Prefetch cache
This is item data pulled out from the database when the site starts up - from the Sitecore docs:
"Each database prefetch cache entry represents an item in a database. Database prefetch cache entries include all field values for all versions of that item, and information about the parent and children of the item.
Populating the prefetch cache results in smoother user experiences immediately after application restarts. Excessive use of prefetch caches can affect the time required for application initialization."
Data cache
This cache is to minimise the round trips to the database, it again pulls item information from Sitecore but the difference being it does it when the item is requested (rather than start-up of the site); it will pull the data from the pre-fetch cache if it's there or go back to the database if not.
Item cache
This cache has objects of type Sitecore.Data.Items.Item which would be used in code; when an item is requested in code it will look in the Item cache, then back up the data cache and up again to pre fetch cache and finally to the database.
HTML cache
This output caches the HTML from sublayouts and renderings, there are a nice level of configuration to only cache the HTML based on querystrings, different data etc.
More details you can find here: https://sitecoreblog.patelyogesh.in/2013/06/how-sitecore-caching-work.html https://doc.sitecore.com/xp/en/sdnarchive/upload/sitecore6/66/cache_configuration_reference_sc66-a4.pdf
Both data and and presentation caching are enable by default in Sitecore.
When it comes to data caching, default values are quite small and can even cause performance issues. You should check your cache sizes and adapt properly.
Sample config file that increases data cache sizes:
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:env="http://www.sitecore.net/xmlconfig/env/">
<sitecore>
<settings>
<setting name="Caching.AccessResultCacheSize">
<patch:attribute name="value">300MB</patch:attribute>
</setting>
<!-- name="Caching.HugeCacheSize" value="100MB" -->
<setting name="Caching.HugeCacheSize">
<patch:attribute name="value">300MB</patch:attribute>
</setting>
<!-- name="Caching.LargeCacheSize" value="10MB" -->
<setting name="Caching.LargeCacheSize">
<patch:attribute name="value">50MB</patch:attribute>
</setting>
<!-- name="Caching.MediumCacheSize" value="1MB" -->
<setting name="Caching.MediumCacheSize">
<patch:attribute name="value">20MB</patch:attribute>
</setting>
<!-- name="Caching.TinyCacheSize" value="10KB" -->
<setting name="Caching.TinyCacheSize">
<patch:attribute name="value">1MB</patch:attribute>
</setting>
</settings>
<databases>
<database id="master" role:require="ContentManagement or Standalone">
<cacheSizes>
<paths>25MB</paths>
<itempaths>200MB</itempaths>
<standardValues>25MB</standardValues>
<data>1000MB</data>
<items>1000MB</items>
</cacheSizes>
<dataProviders>
<dataProvider>
<param desc="headProvider">
<dataProvider>
<prefetch>
<cacheSize>1000MB</cacheSize>
</prefetch>
</dataProvider>
</param>
</dataProvider>
</dataProviders>
</database>
<database id="web" role:require="ContentManagement or ContentDelivery or Standalone">
<cacheSizes>
<paths>25MB</paths>
<itempaths>200MB</itempaths>
<standardValues>25MB</standardValues>
<data>1000MB</data>
<items>1000MB</items>
</cacheSizes>
<dataProviders>
<dataProvider>
<param desc="headProvider">
<dataProvider>
<prefetch>
<cacheSize>1000MB</cacheSize>
</prefetch>
</dataProvider>
</param>
</dataProvider>
</dataProviders>
</database>
</databases>
</sitecore>
</configuration>
In terms of presentation caching - you can enable caching of any component. Be aware that if component is cached, it won't be personalized.
For more information on presentation caching, read chapter 4 in the document: https://doc.sitecore.com/xp/en/SdnArchive/upload/sitecore7/70/presentation_component_reference_sc70-a4.pdf
Update: You can follow @Marek answer for Data cache.
There are 2 ways to apply OOTB Presentation Sitecore Cache -
You can apply the rendering level cache by simply going to rendering in the Sitecore content tree as shown in the screenshot below -
And you can apply the presentation level cache by going to Item's presentation -
And then if you want to check to cache then you can open the URL -
https://abc.com/sitecore/admin/cache.aspx
Here you can see all types of caching enabled.
Follow this blog for more details - https://konabos.com/blog/sitecore-10-1-cache-strategies
If you see the showconfig of your Sitecore instance using the URL https://<your-instance>/sitecore/admin/showconfig.aspx
you will find that the data cache will be configured by default in your instance.
But if you want to configure it then here is the Sitecore official document to configure the Item and Data cache values.
For Presentation level caching you can do the following.
Add caching options to the renderings Sitecore caches output for. You can do this in two ways:
Locally by specifying the options every time you use a rendering. To do this, open the item in the Content Editor, and on the Presentation tab, click Details, and then click the rendering you want to set options for.
Globally by specifying the options in the definition item of the rendering. This is then the default setting for all uses of this rendering. To do this, open the rendering definition item in the sitecore/Layout/Renderings part of the content tree, and navigate to the options in the Caching section.
Refer to this for more details.
Hope this helps.