Skip to content

Commit

Permalink
Fix issue with checking cache item expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
ejsmith committed Sep 16, 2024
1 parent ad61485 commit 25be8c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Foundatio/Caching/InMemoryCacheClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ private async Task DoMaintenanceAsync()
foreach (var kvp in _memory.ToArray())
{
bool lastAccessTimeIsInfrequent = kvp.Value.LastAccessTicks < lastAccessMaximumTicks;
if (lastAccessTimeIsInfrequent && kvp.Value.ExpiresAt <= utcNow)
if (lastAccessTimeIsInfrequent && kvp.Value.ExpiresAt < DateTime.MaxValue && kvp.Value.ExpiresAt <= utcNow)
{
_logger.LogDebug("DoMaintenance: Removing expired key {Key}", kvp.Key);
RemoveExpiredKey(kvp.Key);
Expand Down

0 comments on commit 25be8c8

Please sign in to comment.