educative.io

What is the difference between expires-after and expires-sliding?

As mentioned in the site itself both tag helps the cache tag helper decides the duration for which the cache should be saved. Then what is the difference amongst them?

Hi @Hitesh_Sudhirchandra, we are glad you reached us.

The difference between both the tags is:
expires-after tag expires the cache after a particular time irrespective of any condition, it is bound to expire the cache after the specified time span without considering that it has been used or not in that given time, but expires-sliding expires the cache only if it has not been used in the specified time span.

I hope Educative has helped you in your learning :slight_smile: