David Smith

David Smith

  • NA
  • 2k
  • 0

Timestamp Access Time

Jul 26 2018 1:32 PM
I noticed that you used a timestamp to keep track of your access time. If we ever multithread this cache or if we run on an operating system that does not have a high granularity timestamp this will cause the cache to run incorrectly. Can you refactor your logic so that this will work correctly under any circumstance.
 
I am using this below. How to refactor this to make sure this will work under any circumstance
 
public void UpdateAccessTime() => AccessTime = Stopwatch.GetTimestamp();

Answers (6)