Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: Expiration time issue when you insert items by using the "Cache.Insert" method in the .NET Framework 4.7


View products that this article applies to.

Symptoms

Assume that you have Microsoft .NET Framework 4.7 installed on a computer. When you try to insert items into the Cache object by using the Cache.Insert (string, object, CacheDependency, DateTime, TimeSpan) Insert overload method, you may notice that the inserted Cache items expire much earlier or later than the specified DateTime (expiration time).

↑ Back to the top


Cause

The internal implementation of System.Web.Caching.Cache uses Coordinated Universal Time (UTC) time-stamp for absolute expiration. But this particular Cache.Insert (string, object, CacheDependecy, DateTime, TimeSpan) Insert overload method does not make sure whether the expiration time is converted to UTC. Therefore, expiration for items that are inserted into the Cache object by using this overload will occur earlier or later than expected, depending on the computer time zone difference from Greenwich Mean Time (GMT).

↑ Back to the top


Workaround

The temporary workaround for this issue is to use either the Cache.Add method or a different Cache.Insert overload method.

↑ Back to the top


Resolution

This issue will be fixed in the next version of the .NET Framework, and will also be available in the next hotfix for the .NET Framework 4.7.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


Keywords: kbqfe, kbfix, kbsurveynew, kbexpertiseadvanced, kb

↑ Back to the top

Article Info
Article ID : 4035412
Revision : 12
Created on : 7/19/2017
Published on : 7/19/2017
Exists online : False
Views : 411