TLDR; The cart block is now lazy loaded.
Considerations:
- If you have subclassed the cart block and overridden the
getCartViews()method, this method has been moved to the new service class:CartLazyBuilders. - If you were relying on the cart block to cause a page cache entry to be purged, the cart will no longer cause this to occur. This generally shouldn't be an issue, unless you had another component on the page that had not set its cache tags and contexts.
The details:
The cart contents are user, session, and cart dependent.
The cart block is typically placed in the header or sidebar. This means its contents are cached individually on virtually every page for every user who has a cart.
If a customer visits 10 pages, ten page cache entries are created. When the customer modifies their cart, then all 10 page entries are purged.
If 1,000 customers do the same, then this becomes 10,000 page cache entries. This can quickly fill the cache, yet also cause constant purging as cache entries become stale as carts are modified. This hinders performance and scalability.
By making the cart block lazy loading, those 10 pages will only take 10 cache entries now(and won't be purged every time the carts are modified), along with the 1,000 entries for the 1,000 carts. In this example, we have now reduced 10,000 entries to 1,010 in entries.
By making the cart block lazy loading, we significantly reduce the number of items being cached, and the frequency those items are purged and recreated.