Methods and apparatus, including computer program products, for purging an
item from a cache based on the expiration of a period of time and having
an associated process to generate an item purged from the cache. A
program stores a first item in a cache with an indication of a process to
generate the first item, schedules a validity period for the first item,
and purges the first item from the cache when the validity period has
expired. The validity period may be optimized to be less than a period of
time after which the first item would be promoted from a first generation
of the cache to a second generation of the cache and invalid objects in
the first generation of the cache are freed from memory more frequently
than invalid objects in the second generation of the cache.