DistributedCache.AzureTableStorage 3.3.1

dotnet add package DistributedCache.AzureTableStorage --version 3.3.1
                    
NuGet\Install-Package DistributedCache.AzureTableStorage -Version 3.3.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DistributedCache.AzureTableStorage" Version="3.3.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DistributedCache.AzureTableStorage" Version="3.3.1" />
                    
Directory.Packages.props
<PackageReference Include="DistributedCache.AzureTableStorage" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DistributedCache.AzureTableStorage --version 3.3.1
                    
#r "nuget: DistributedCache.AzureTableStorage, 3.3.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=DistributedCache.AzureTableStorage&version=3.3.1
                    
Install as a Cake Addin
#tool nuget:?package=DistributedCache.AzureTableStorage&version=3.3.1
                    
Install as a Cake Tool

DistributedCache.AzureTableStorage

  • Based on oceanweb/azuretablestoragecache but with lower dependencies.
  • Extra added logic to use strongly typed objects with IDistributedCache instead of byte arrays.
  • Multiple versions are available, see table below for details.

Code example

Configure in code (option 1)

c# code:

// Configure in code
services.Configure<AzureTableStorageCacheOptions>(options =>
{
    options.TableName = "CacheTest";
    options.PartitionKey = "ConsoleApp";
    options.ConnectionString = "UseDevelopmentStorage=true;";
    options.ExpiredItemsDeletionInterval = TimeSpan.FromHours(24);
});
Notes
  • If the TableName does not exists, it's created. If you want to disable this behaviour, set the options.CreateTableIfNotExists to false.
  • When an item is retrieved or added to to the cache, a periodic interval scan can be done to find and delete expired items in the cache. Default this is set to null, which means that this functionality is disabled. If you want to change this, set the options.ExpiredItemsDeletionInterval to a different value, like TimeSpan.FromMinutes(30).
Configure via appsettings.json (option 2)

appsettings.json:

"AzureTableStorageCacheOptions": {
  "ConnectionString": "UseDevelopmentStorage=true;",
  "TableName": "CacheTest",
  "PartitionKey": "ConsoleApp"
}

c# code:

// Configure via app.setttings
services.Configure<AzureTableStorageCacheOptions>(Configuration.GetSection("AzureTableStorageCacheOptions"));
Add DistributedAzureTableStorageCache to services
services.AddDistributedAzureTableStorageCache();
Usage
IDistributedCache cache = ... // injected via DI

var test = new TestModel
{
    Id = 1,
    Name = "Test 1"
};

// Set an item in the cache using an expiration from 30 seconds
var cacheOptions = new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(30) };
await cache.SetAsync("t1", test, cacheOptions);

// Retrieve the item from the cache
var t2 = await cache.GetAsync<TestModel>("t1");
logger.LogInformation("t2 : {TestModel}", JsonConvert.SerializeObject(t2));

Sponsors

Entity Framework Extensions and Dapper Plus are major sponsors and proud to contribute to the development of DistributedCache.AzureTableStorage.

Entity Framework Extensions

Dapper Plus

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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 is compatible. 
.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on DistributedCache.AzureTableStorage:

Package Downloads
DataFunc.IMemoryCache.AzureTableStorage

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.3.1 409 9 days ago
3.3.0 26,289 7 months ago
3.2.0 106,536 5/10/2023
3.1.0 22,597 10/21/2022
3.1.0-preview-02 198 10/21/2022
3.1.0-preview-01 215 10/20/2022
3.0.1 10,602 7/12/2022
3.0.0-preview-01 176 6/18/2022
2.2.1 134 9 days ago
2.2.1-preview 124 9 days ago
2.2.0 311 5/10/2023
2.2.0-preview 267 5/10/2023
2.1.0 1,126 10/21/2022
2.1.0-preview 175 10/21/2022
2.0.1 32,879 2/5/2021
2.0.1-preview 288 2/5/2021
2.0.0 10,122 6/12/2020
2.0.0-preview-03 371 6/10/2020
2.0.0-preview-02 540 5/25/2020
2.0.0-preview-01 4,458 2/28/2020
1.2.1 126 9 days ago
1.2.0 407 10/21/2022
1.1.0 1,446 6/12/2020
1.0.4 3,993 9/13/2019
1.0.3 1,037 2/15/2019
1.0.2 697 2/13/2019
1.0.1 715 2/9/2019
1.0.0 742 2/8/2019
1.0.0-preview-01 585 2/8/2019

See CHANGELOG.md