Skyward.Caching.ETagMiddleware
0.3.0
dotnet add package Skyward.Caching.ETagMiddleware --version 0.3.0
NuGet\Install-Package Skyward.Caching.ETagMiddleware -Version 0.3.0
<PackageReference Include="Skyward.Caching.ETagMiddleware" Version="0.3.0" />
paket add Skyward.Caching.ETagMiddleware --version 0.3.0
#r "nuget: Skyward.Caching.ETagMiddleware, 0.3.0"
// Install Skyward.Caching.ETagMiddleware as a Cake Addin #addin nuget:?package=Skyward.Caching.ETagMiddleware&version=0.3.0 // Install Skyward.Caching.ETagMiddleware as a Cake Tool #tool nuget:?package=Skyward.Caching.ETagMiddleware&version=0.3.0
Provide a simplistic and naive version of ETag caching that simply saves on data transfer
[https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag)
ETag caching can be a quick way of determining if data needs to be downloaded from the server. An ETag is returned with a resource,
and the browser remembers it. When the browser requests the resource again, it includes the ETag for the last download.
The server can then respond with a 304 Not Modified response, and the browser will simply re-use what it downloaded last time.
Typically an ETag is a checksum of some kind, a version timestamp, or some other way of representing the version of data.
The Skyward naive implementation simply calculates a checksum on every response body of a GET request, and includes it as
an ETag.
On subsequent requests, it compares this to the version included in the request. If the checksums match, it returns the 304.
There are several things to note here:
* Currently there is no way to opt in or out; every GET request gets this behaviour.
* In order to calculate the checksum, the entire response stream must be read into memory. This at best duplicates the data, and
at work loads an otherwise efficient stream (for example, a file stream) into memory all at once, where otherwise it would not need to.
* As stated, this is a naive implmentation, meaning it does not save the server any processing. A more informed ETag implementation would
track the checksum with the data, so the entire call could be circumvented. This implmentation requires the call to run even if not needed.
* The lone benefit is to prevent downloading unrequired data. This has been used on projects to prevent an entire 1MB json request from being
retrieved on every poll (unless the data has actually changed).
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.WebUtilities (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.2.0)
- Microsoft.Extensions.Logging.Abstractions (>= 2.2.0)
- Microsoft.Net.Http.Headers (>= 2.2.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.3.0 | 2,073 | 2/27/2023 |
Added sourcelink