Automatic Cache Time Expiring

Asked

Viewed 71 times

2

I am using the function below to store the cache was working normal, but now when add the time of 60min is as if it expires auto, now if I insert a longer time as 181min the cache is maintained.

If anyone can help me, I’d be grateful.

HttpContext.Current.Cache.Insert(chave,
                valor,
                null,
                DateTime.Now.AddMinutes(60),
                Cache.NoSlidingExpiration);

1 answer

1


This may be due to a problem with timezones.

Instead of

DateTime.Now.AddMinutes(60)

Prefer

DateTime.UtcNow.AddMinutes(60)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.