In my practice I've never really faced with situation that it was needed to clean the collection cache. It is strange)
I checked and detected that the magento uses the collection cache only for 4 entities:
website
store_group
store
category
These entities uses for their collections the virtual types based on
\Magento\Framework\Data\Collection\Db\FetchStrategy\Cache
which in turn uses \Magento\Framework\App\Cache\Type\Collection
for defining the cache type - collection
.
You can find the all SQL-queries which used (after md5 tranformation) as cache keys - see the fetchAll
method.
And these SQL-queries only to tables which related to entities listed above.
Why doesn't magento use the collection cache for other entities, such as products or CMS-pages?
When should we use the collection cache for own custom entities?