---
title: "What is Absolute and Sliding expiration in .NET?"  
description: "What is Absolute and Sliding expiration in .NET?"  
author: "Anonymous User"  
published: 2011-08-24  
updated: 2020-09-21  
canonical: https://www.mindstick.com/interview/1159/what-is-absolute-and-sliding-expiration-in-dot-net  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 2 minutes  

---

# What is Absolute and Sliding expiration in .NET?

Absolute and sliding expiration are two Time based expiration strategies.\
\
Absolute Expiration: Cache in this case expires at a fixed specified date or time.\
Example: Cache. Insert("ABC", ds, null, DateTime.Now.AddMinutes(1), Cache.NoSlidingExpiration);\
The cache is set to expire exactly two minutes after the user has retrieved the data.\
\
Sliding Expiration: the cache duration increases in this case by the specified sliding expiration value every time the page is requested. More a page is requested it will remain in cache, whereas a less requested page will not remain in cache.\
Example: Cache.Insert("ABC", ds, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(1));

## Answers

### Answer by Anonymous User

Absolute and sliding expiration are two Time based expiration strategies.\
\
Absolute Expiration: Cache in this case expires at a fixed specified date or time.\
Example: Cache. Insert("ABC", ds, null, DateTime.Now.AddMinutes(1), Cache.NoSlidingExpiration);\
The cache is set to expire exactly two minutes after the user has retrieved the data.\
\
Sliding Expiration: the cache duration increases in this case by the specified sliding expiration value every time the page is requested. More a page is requested it will remain in cache, whereas a less requested page will not remain in cache.\
Example: Cache.Insert("ABC", ds, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(1));


---

Original Source: https://www.mindstick.com/interview/1159/what-is-absolute-and-sliding-expiration-in-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
