jitbit / FastCache

7x-10x faster alternative to MemoryCache. A high-performance, lighweight (8KB dll) and thread-safe memory cache for .NET.
MIT License
135 stars 13 forks source link

TickCountWhenToKill appears to be populated incorrectly #9

Closed GoldieLocks89 closed 6 months ago

GoldieLocks89 commented 6 months ago

https://github.com/jitbit/FastCache/blob/2a016db71fd766a49496d927c553fafec6a152a3/FastCache/FastCache.cs#L247

Isn't there a bug here? You're adding ttl.TotalMilliseconds to the current tick count, shouldn't you be adding ttl.Ticks?

alex-jitbit commented 6 months ago

Nope. It's a misleading name, the thing actually holds milliseconds.

https://learn.microsoft.com/en-us/dotnet/api/system.environment.tickcount64?view=net-8.0

Environment.TickCount64 Property Gets the number OF MILLISECONDS elapsed since the system started.