Home | Cache invalidation | 2.1.2 Where caching is performed
Cache item dependencies
To complicate matters, cached items may have dependent relationships with other components held in the cache. A group of dependent items may all become invalid if any of the associated components are changed.
For example, the contents of a shopping cart held in a cache may be invalidated by changes made to an order by a customer. Furthermore, order item changes could potentially invalidate any related, cached, inventory components.
Invalid related items present us with a tricky problem. We need to discard them all at the same time. We therefore need a mechanism to evict all parties affected by change.
One solution involves grouping related items with a dependency ID attribute. When an item with a particular dependency ID is invalidated, then all related items that share that same dependency ID are also discarded.
Figure 2-2 Related items can be invalidated through the use of dependency ID