Search code examples
distributed-cachingdistributed-cachedache

What is SlidingExpiration Timespan in Dache?


What is SlidingExpiration Timespan in AddOrUpdate method in Dache, exactly?
Is it better to use SlidingExpiration or AbsoluteExpiration,
I mean what is the differences?


Solution

  • Sliding Expiration means it's the period of time where the object haven't been touched, then it'll be removed from cache. That basically means as long as somebody accesses the object(s), the timer will be reset.

    Absolute Expiration means it's the period of absolute time before the object will be removed, regardless of usage. So once the absolute time have been reached, the object will be marked for removal.

    What is better depends on your data and it's usage and your cache strategy