ScaledDomains.Extensions.Caching.MySql.Core
3.0.2
dotnet add package ScaledDomains.Extensions.Caching.MySql.Core --version 3.0.2
NuGet\Install-Package ScaledDomains.Extensions.Caching.MySql.Core -Version 3.0.2
<PackageReference Include="ScaledDomains.Extensions.Caching.MySql.Core" Version="3.0.2" />
paket add ScaledDomains.Extensions.Caching.MySql.Core --version 3.0.2
#r "nuget: ScaledDomains.Extensions.Caching.MySql.Core, 3.0.2"
// Install ScaledDomains.Extensions.Caching.MySql.Core as a Cake Addin #addin nuget:?package=ScaledDomains.Extensions.Caching.MySql.Core&version=3.0.2 // Install ScaledDomains.Extensions.Caching.MySql.Core as a Cake Tool #tool nuget:?package=ScaledDomains.Extensions.Caching.MySql.Core&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.
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
mysql-distributed-cache
.NET CLI Tool
The following example creates table with myDistributedCache
name on MySQL server (example.com
) under the pizzaordersystem-db
schema.
The CLI tool parameters:
- [connectionString] - The mysql connection string to connect to the database.
- [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 | Versions 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. |
-
.NETStandard 2.0
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.2)
-
net6.0
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.2)
-
net8.0
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.2)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on ScaledDomains.Extensions.Caching.MySql.Core:
Package | Downloads |
---|---|
ScaledDomains.Extensions.Caching.MySql
ScaledDomains.Extensions.Caching.MySql.MySqlConnector is a free, open source distributed cache implementation using MySql as datastore using MySql.Data. |
|
ScaledDomains.Extensions.Caching.MySql.MySqlConnector
ScaledDomains.Extensions.Caching.MySql.MySqlConnector is a free, open source distributed cache implementation using MySql as datastore using MySqlConnector. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.0.2 | 713 | 4/16/2024 |
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