Skip to content

Commit

Permalink
echance
Browse files Browse the repository at this point in the history
  • Loading branch information
SlothRemige committed May 27, 2024
1 parent b34588f commit 8a0f15c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion FastCache.InMemory/Drivers/MemoryCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public Task<CacheItem> Get(string key)
return Task.FromResult(new CacheItem()
{
CreatedAt = cacheItem.CreatedAt,
Value = JsonConvert.DeserializeObject(cacheItem.Value as string, valueType),
Value = cacheItem.Value == null ? null : JsonConvert.DeserializeObject(cacheItem.Value as string, valueType),

Check warning on line 67 in FastCache.InMemory/Drivers/MemoryCache.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'value' in 'object? JsonConvert.DeserializeObject(string value, Type type)'.
Expire = cacheItem.Expire,
Hits = cacheItem.Hits,
Type = cacheItem.Type,
Expand Down
1 change: 1 addition & 0 deletions UnitTests/MemoryCacheTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public async void TestMemoryCacheCanSet(string key, string value, string result)
[Theory]
[InlineData("anson2", "18", null)]
[InlineData("anson22", "19", null)]
[InlineData("anson22", null, null)]
public async void TestMemoryCacheCanDelete(string key, string value, string result)
{
await _memoryCache.Set(key, new CacheItem()
Expand Down

0 comments on commit 8a0f15c

Please sign in to comment.