...

/

Time to Leave and Eviction Policies in Caching

Time to Leave and Eviction Policies in Caching

Get to know what time-to-leave and eviction policies are in caching.

In this lesson, let’s extend our knowledge of some core caching concepts and caching types that we will need to keep in mind while working on distributed systems.

Time to leave (TTL)

We can see that frequently accessed data can be cached and retrieved faster. But we cannot store all data in the cache forever. There are several reasons for this:

  • Unless data is absolutely static and never changes, at some point, data is supposed to be updated. Continuing to store data on the cache for a long time will result in a stale response.
  • A piece of data that is frequently accessed today may not be of much use tomorrow. There is no point in storing it in the cache if it is not accessed much.
  • Finally, a cache is an expensive component as it is based on RAM—and obviously much smaller than a
...