Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e020e2f
Add global json + release notes txt
thomasgalliker Apr 6, 2026
e7593c5
Update azure build config
thomasgalliker Apr 6, 2026
dd7fae6
Bump version to 2.0
thomasgalliker Apr 6, 2026
74d9f2d
Update release notes
thomasgalliker Apr 6, 2026
2906f18
Update namespace
thomasgalliker Apr 6, 2026
2813898
Update sample project
thomasgalliker Apr 6, 2026
6d242db
Update license
thomasgalliker Apr 6, 2026
25c2454
Move logo
thomasgalliker Apr 6, 2026
5400d6b
Update csproj infos
thomasgalliker Apr 6, 2026
06f2f57
Replace Newtonsoft.Json with System.Text.Json
thomasgalliker Apr 6, 2026
926fe37
Cleanup nullable reference warnings
thomasgalliker Apr 6, 2026
51a6855
Update package tags
thomasgalliker Apr 6, 2026
7252de8
Update csproj of test project
thomasgalliker Apr 6, 2026
5b579d9
Merge pull request #23 from thomasgalliker/maintenance-20260406
thomasgalliker Apr 6, 2026
638f1a5
Replace MemoryCache implementation with Microsoft.Extensions.Caching.…
thomasgalliker Apr 6, 2026
b1e7735
Fix namespace names
thomasgalliker Apr 6, 2026
e362a85
Add Clear method as extension method for IMemoryCache
thomasgalliker Apr 21, 2026
2e822b9
Merge extension methods
thomasgalliker Apr 21, 2026
1b24731
Add TryGetValue with NotNullWhen(true) for value
thomasgalliker May 11, 2026
d226a3c
Merge pull request #24 from thomasgalliker/replace-memory-cache
thomasgalliker May 16, 2026
e4d285f
Replace FluentAssertions with AwesomeAssertions
thomasgalliker May 28, 2026
274453d
Skip pack for pull request builds
thomasgalliker Jun 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions HttpClient.Caching.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.gitignore = .gitignore
azure-pipelines.yml = azure-pipelines.yml
README.md = README.md
global.json = global.json
ReleaseNotes.txt = ReleaseNotes.txt
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleAppSample", "Samples\ConsoleAppSample\ConsoleAppSample.csproj", "{592B2324-79AA-4973-8CE5-F65BD503641F}"
Expand Down
1 change: 0 additions & 1 deletion HttpClient.Caching/Abstractions/CacheData.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Collections.Generic;
using System.Net.Http;

namespace Microsoft.Extensions.Caching.Abstractions
Expand Down
28 changes: 15 additions & 13 deletions HttpClient.Caching/Abstractions/CacheDataExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
using System;
using Newtonsoft.Json;
using System.Net;
using System.Net.Http;
using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.Extensions.Caching.Internals;

namespace Microsoft.Extensions.Caching.Abstractions
{
public static class CacheDataExtensions
{
private static readonly JsonSerializerOptions SerializerOptions = new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
Converters = { new CacheDataJsonConverter() }
};

public static byte[] Serialize(this CacheData cacheData)
{
var json = JsonConvert.SerializeObject(cacheData);
var bytes = new byte[json.Length * sizeof(char)];
Buffer.BlockCopy(json.ToCharArray(), 0, bytes, 0, bytes.Length);
return bytes;
return JsonSerializer.SerializeToUtf8Bytes(cacheData, SerializerOptions);
}

public static CacheData Deserialize(this byte[] cacheData)
{
try
{
var chars = new char[cacheData.Length / sizeof(char)];
Buffer.BlockCopy(cacheData, 0, chars, 0, cacheData.Length);
var json = new string(chars);
var data = JsonConvert.DeserializeObject<CacheData>(json);
return data;
return JsonSerializer.Deserialize<CacheData>(cacheData, SerializerOptions)!;
}
catch
{
return null;
return null!;
}
}
}
}
}
113 changes: 0 additions & 113 deletions HttpClient.Caching/Abstractions/CacheExtensions.cs

This file was deleted.

13 changes: 0 additions & 13 deletions HttpClient.Caching/Abstractions/CacheItemPriority.cs

This file was deleted.

12 changes: 0 additions & 12 deletions HttpClient.Caching/Abstractions/EvictionReason.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static async Task<CacheData> ToCacheEntryAsync(this HttpResponseMessage h
return httpResponseMessage.ToCacheEntry(contentBytes);
}

#if NET5_0_OR_GREATER
#if NET8_0_OR_GREATER
public static CacheData ToCacheEntry(this HttpResponseMessage httpResponseMessage)
{
using var contentStream = httpResponseMessage.Content.ReadAsStream();
Expand Down
51 changes: 0 additions & 51 deletions HttpClient.Caching/Abstractions/ICacheEntry.cs

This file was deleted.

4 changes: 2 additions & 2 deletions HttpClient.Caching/Abstractions/ICacheKeysProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public interface ICacheKeysProvider
/// <summary>
/// Return the key for the request message <paramref name="request"/>
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
/// <param name="request">The http request message.</param>
/// <returns>The cache key.</returns>
string GetKey(HttpRequestMessage request);
}
}
26 changes: 0 additions & 26 deletions HttpClient.Caching/Abstractions/IChangeToken.cs

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions HttpClient.Caching/Abstractions/PostEvictionDelegate.cs

This file was deleted.

2 changes: 0 additions & 2 deletions HttpClient.Caching/Abstractions/StatusCodeExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;
using System.Collections.Generic;
using System.Net;

namespace Microsoft.Extensions.Caching.Abstractions
Expand Down
Loading