WIP: Cache invalidation by entity.

#6043 
WIP
why is this needed?