Hi @Bhuwan ,
You can try storing expired values in the values of cached objects and using the same values for caching as expired values.
var expiry = DateTime.UtcNow.AddMinutes(10);
HttpRuntime.Cache.Insert("key", new { Value = "Value", Expiry = expiry }, null, expiry, Cache.NoSlidingExpiration);
When you need to check the expiration time, you can get the expiration properties of the object.
dynamic cachedData = HttpRuntime.Cache.Get("key");
DateTime cacheExpiry = cachedData.Expiry;
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.