ScaledDomains.Extensions.Caching.MySql 3.0.2

dotnet add package ScaledDomains.Extensions.Caching.MySql --version 3.0.2
NuGet\Install-Package ScaledDomains.Extensions.Caching.MySql -Version 3.0.2
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="ScaledDomains.Extensions.Caching.MySql" Version="3.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ScaledDomains.Extensions.Caching.MySql --version 3.0.2
#r "nuget: ScaledDomains.Extensions.Caching.MySql, 3.0.2"
#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.
// Install ScaledDomains.Extensions.Caching.MySql as a Cake Addin
#addin nuget:?package=ScaledDomains.Extensions.Caching.MySql&version=3.0.2

// Install ScaledDomains.Extensions.Caching.MySql as a Cake Tool
#tool nuget:?package=ScaledDomains.Extensions.Caching.MySql&version=3.0.2

ScaledDomains.Extensions.Caching.MySql

About

ScaledDomains.Extensions.Caching.MySql is a free, open source distributed cache implementation using MySql as datastore, inspired by Microsoft.Extensions.Cachning.SqlServer. Founded and maintained by Endre Toth and Attila Ersek.

Build License Codecov SonarCloud

Getting started

The Distributed MySQL Server Cache implementation allows the distributed cache to use a MySQL Server database as its caching store. To create a table in a database instance, you can use the mysql-distributed-cache tool. The tool creates a table the name that you specify.

1. Create table

1.1 Requirements

The following example creates table with myDistributedCache name on MySQL server (example.com) under the pizzaordersystem-db schema.

The CLI tool parameters:

  1. [connectionString] - The mysql connection string to connect to the database.
  2. [tableName] - Name of the table to be created.
mysql-distributed-cache Server=example.com;Database=pizzaordersystem-db;User=dbAdmin; myDistributedCache

The connection string may contain credentials that should be kept out of source control systems.

The table has the following schema:

describe `pizzaordersystem-db`.`myDistributedCache`;
Field Type Null Key Default Extra
Id varchar(767) NO PRI NULL
AbsoluteExpiration datetime(6) YES NULL
ExpiresAt datetime(6) NO MUL NULL
SlidingExpiration time(6) YES NULL
Value longblob NO NULL

2. Setup your application

The package manipulates cache values using an instance of IDistributedCache.

services.AddDistributedMySqlServerCache(options => {
                options.ConnectionString = _config["DistributedCache_ConnectionString"];
                options.TableName = "myDistributedCache";
});
2.1 Options
Property Type Description Default Required/Optional
ConnectionString string The connection string to the database. REQUIRED
TableName string Name of the table where the cache items are stored. REQUIRED
ExpirationScanFrequency TimeSpan The minimum length of time between successive scans for expired items. 00:20:00 OPTIONAL

Usage

The IDistributedCache interface provides basic methods to manage items, in the distributed cache implementation:

  • Get, GetAsync: Accepts a string key and retrieves a cached item as a byte[] array if found in the cache.
  • Set, SetAsync: Adds an item (as byte[] array) to the cache using a string key.
  • Refresh, RefreshAsync: Refreshes an item in the cache based on its key, resetting its sliding expiration timeout (if any).
  • Remove, RemoveAsync: Removes a cache item based on its string key.

Limits

  • Cache key length must be less than 767 and encoding should be ASCII.
  • The maximum size of the cache item is 4Gb.

Bug reports and feature requests

Please use the Issue Tracker.

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. 
.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
3.0.2 89 4/16/2024
3.0.1 77 4/16/2024
2.1.0 709 2/20/2024
2.0.3 191 2/14/2024
1.0.0 18,728 9/15/2020
1.0.0-alfa1 315 9/14/2020

Version 3.0.0
     * Refactor code to add support for MysqlConnector
     Version 2.1.0
     * Multitargeting netstandard2.0;net6.0;net8.0
     * Add package readme
     Version 2.0.0
     * Bump dependencies
     * Set target framework to net6.0
     Version 1.0.0
     * Initial release