How prefetch cache update its cached item, If I change the content of Sitecore item? And also other ways of prefetch cache refreshing?
2 Answers
Sitecore populate prefetch catches just at application inititialization, and it maintains it during the lifetime of the application. Is not possible to update after you run the app and the prefetch cache is already initialized.
Bellow are some information about prefetch cache :
- There is a prefetch cache for each database
- Each cache entry is populated from the databases at Sitecore startup
The items to cache are specified in the /app_config/prefetch config files Cached items includes those in the config file for the specific database (for instance master.config) and the common.config file
Entries include all field values for all versions of the item and information about the parent and children of the item
- The
<childLimit>
element defines a limit to the number of children to include in the prefetch cache
More informations: http://learnsitecore.cmsuniverse.net/en/Developers/Articles/2009/07/CachingOverview.aspx
https://blog.boro2g.co.uk/sitecore-prefetch-cache/
https://sdn.sitecore.net/upload/sitecore6/sc62keywords/cache_configuration_reference_us.pdf
-
lobagiu: if i add, setting template in prefetch setting, and i change the setting template field and publish, will cache update? Commented Apr 5, 2018 at 6:20
-
-
The accepted answer contains many incorrect assumptions that have been perpetuated for quite some time.
The full answer to your question is below:
Sitecore does this constantly. All CRUD operations (create, read, update, delete) modify the prefetch cache. This includes scaled topology such as a content delivery server. During a publish, the CM server queues an event in the web database event queue. The CD server reads this event after a few seconds. One of the subscribers to this event then clears the item from the prefetch cache. This in turn causes the next retrieval of the item to come from the database.
The create, update (savedItem) and delete operations clear the item from the cache. The read operation populates the cache. This basic logic ensures the prefetch cache holds the correct data at all times.
The accepted answer convolutes the App_Config\Prefetch
configuration with the cache itself. The configurations within App_Config\Prefetch
simply instruct Sitecore to retrieve these items (templates, children, etc.. regardless it's items). These items are then added to the prefetch cache. This bootstraps the application by not returning any requests until these operations complete. The more items set to be prefetched, the longer the startup time of the application.
However, after this initial seeding of items, the prefetch cache continues to be managed by Sitecore- in particular the SqlDataProvider. Any operations in or or out of SQL are mirrored by the prefetch cache.