From e318f8c9abf5b386526266763efd28d3325ae6e8 Mon Sep 17 00:00:00 2001 From: kubagdynia Date: Sat, 16 Mar 2024 13:34:28 +0100 Subject: [PATCH] Update libraries. --- .../CacheDrive.ExampleConsoleApp.csproj | 2 +- CacheDrive.Tests/CacheDrive.Tests.csproj | 4 ++-- CacheDrive/CacheDrive.csproj | 8 ++++---- CacheDrive/Services/MemoryCacheService.cs | 3 ++- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CacheDrive.ExampleConsoleApp/CacheDrive.ExampleConsoleApp.csproj b/CacheDrive.ExampleConsoleApp/CacheDrive.ExampleConsoleApp.csproj index 4f858a3..cc3c830 100644 --- a/CacheDrive.ExampleConsoleApp/CacheDrive.ExampleConsoleApp.csproj +++ b/CacheDrive.ExampleConsoleApp/CacheDrive.ExampleConsoleApp.csproj @@ -13,7 +13,7 @@ - + diff --git a/CacheDrive.Tests/CacheDrive.Tests.csproj b/CacheDrive.Tests/CacheDrive.Tests.csproj index 3e0690a..b5683e7 100644 --- a/CacheDrive.Tests/CacheDrive.Tests.csproj +++ b/CacheDrive.Tests/CacheDrive.Tests.csproj @@ -13,13 +13,13 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/CacheDrive/CacheDrive.csproj b/CacheDrive/CacheDrive.csproj index 9b2fc37..69beb52 100644 --- a/CacheDrive/CacheDrive.csproj +++ b/CacheDrive/CacheDrive.csproj @@ -5,20 +5,20 @@ CacheDrive Simple in-memory caching provider with the ability to store objects in files. cache memory-cache file-cahce - Bug fix related to the ability to enable and disable the cache (CacheEnabled). + Update libraries. https://github.com/kubagdynia/CacheDrive true https://github.com/kubagdynia/CacheDrive MIT - 2023 - 0.1.1 + 2023-2024 + 0.1.2 Jakub Kurłowicz CacheDrive.png - + diff --git a/CacheDrive/Services/MemoryCacheService.cs b/CacheDrive/Services/MemoryCacheService.cs index 6e22347..b66cd42 100644 --- a/CacheDrive/Services/MemoryCacheService.cs +++ b/CacheDrive/Services/MemoryCacheService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Concurrent; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using CacheDrive.Configuration; @@ -295,7 +296,7 @@ private CachedItem Get(ICacheable item) => Get(item.CacheKey); private CachedItem Get(string key) - => Storage.TryGetValue(key, out CachedItem cachedItem) ? cachedItem : null; + => Storage.GetValueOrDefault(key); private void CalculateCacheExpiration() {