DotNetXtensions.DCache
1.0.1
See the version list below for details.
dotnet add package DotNetXtensions.DCache --version 1.0.1
NuGet\Install-Package DotNetXtensions.DCache -Version 1.0.1
<PackageReference Include="DotNetXtensions.DCache" Version="1.0.1" />
paket add DotNetXtensions.DCache --version 1.0.1
#r "nuget: DotNetXtensions.DCache, 1.0.1"
// Install DotNetXtensions.DCache as a Cake Addin
#addin nuget:?package=DotNetXtensions.DCache&version=1.0.1
// Install DotNetXtensions.DCache as a Cake Tool
#tool nuget:?package=DotNetXtensions.DCache&version=1.0.1
DotNetXtensions.DCache
DCache
is intended to be a simple typed version of IDistributedCache
,
useful when getting or putting a single type from the cache of a given type T
.
Thus behind the scenes this type handles serialization / deserialization of the raw
strings and bytes to and from the cache, allowing the caller to treat this almost as
as a simple in-memory dictionary. A second major purpose
of this type is that it allows in-memory caching to be employed (for a specified time),
by means of an internal DotNetXtensions.CacheDictionary{TKey, TValue}
instance
(thus the dependency on nuget pkg DotNetXtensions.Common
). This can be powerful in less
change-sensitive scenarios. In those cases it can remove the extra
latency of a cache call entirely, when within a certain window and when this (server etc) instance
had let's say just accessed the given item and it is still in memory.
CONSIDERATIONS
This type makes a number of basic assumptions, that makes this type useful only when the following considerations are acceptable:
This encapsulates a single type. Nothing stops using multiple instances, but compared to the full
IDistributedCache
, this type is limited to a single keyed type access of items from the backing cache. E.g. to access aCustomerInfo
type stored in the cache to be saved / retrieved using a singular keyed prefix, namelyCacheKeyPrefix
.Serialization / deserialization of the type
T
is performed right now by System.Text.Json.JsonSerializer (.NET's new json serializer). While a binary serializer may be nice, the simplicity of this right now wins out. While you can set a customSystem.Text.Json.JsonSerializerOptions
instance, if this json serializer doesn't suffice for serializing the typeT
, then this won't work.The key type
TId
must be able to serialize to a string for the cache key by means of calling ToString on it. This limitation could be solved later, but is here for the moment.This type is strongly bound (on purpose) to
IDistributedCache
, and thus also to theMicrosoft.Extensions.Caching.Distributed
namespace, and to the closely relatedDistributedCacheEntryOptions
type. It also takes a dependency on the internally usedCacheDictionary{TKey, TValue}
type from
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. 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. |
-
net5.0
- DotNetXtensions (>= 4.0.1)
- DotNetXtensions.Common (>= 3.5.0)
- Microsoft.Extensions.Caching.Abstractions (>= 3.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.