Skip to content

Commit 8f30a15

Browse files
committed
Use sliding window for cache
1 parent 028ca4c commit 8f30a15

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/LinkDotNet.Blog.Infrastructure/Persistence/CachedRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public async ValueTask<T> GetByIdAsync(string id)
2222
{
2323
return await memoryCache.GetOrCreateAsync(id, async entry =>
2424
{
25-
entry.AbsoluteExpirationRelativeToNow = TimeSpan.FromDays(7);
25+
entry.SlidingExpiration = TimeSpan.FromDays(7);
2626
return await repository.GetByIdAsync(id);
2727
});
2828
}

0 commit comments

Comments
 (0)