2

I can understand that the Prefetch cache is very useful for caching items in the database - thereby reducing reads to the SQL server. I can also understand the HTML cache is useful for caching the end result of a rendered component - thereby greatly improving performance. I would like to know what kind of benefit the Item and Data caches give? They seem very similar to me and I'm wondering if they are both needed - or are they just consuming memory for little gain?

1

Data Cache - Data caches store data from all the data providers defined for the database. The cache contains items of the Sitecore class “ItemInformation”, pulled from the database whenever they are requested.

The data is pulled from the Prefetch cache, if it presents there; else it is pulled out of the database, put into the Prefetch cache and into then the data cache.

The purpose of this cache is to minimise the number of requests to the database. This is extremely important for performance, as requesting items from the database is rather expensive. The maximum size of the Data cache can be configured.

Item Cache - Item caches contain objects of the Sitecore class “Sitecore.Data.Items.Item” that are used in the code most of the time.

The items are built from the “ItemInformation” objects in the data cache, hence, are dependent on database data caches. So, if we request an item, which isn’t present in the item cache, it will get it from the data cache and then populate it in the item cache as an Item.

The reason for this cache is to gain performance so the ItemInformation objects don’t need to get parsed into an Item each time they are requested.

Hope above information will help.

2
  • Thanks for this explanation. I ran some tests on a page that was hitting a lot of items (10k items). All caches enabled as normal - 10s load time. Disabling both Item and Data cache - 25s load time. Disabling just Data cache - 20s load time. Disabling just Item cache - 12s load time. So Item cache does have some small benefit worth the memory usage from that test. Apr 23 '20 at 23:52
  • Happy that you liked my answer. That's true, these Sitecore caching make impact in page performance.,
    – AB1005
    Apr 26 '20 at 21:52
0

The ItemCache caches the Item itself, with all of the fields and associated information. It allows for faster retrieval when you call GetItem or when Items are resolved in pipelines such as HttpRequest so that there aren't constant database queries.

The DataCache caches Information about the an item, such as the item's Child ID's, the languages and versions, the parent, and information surrounding the template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.