![]() |
VOOZH | about |
dotnet tool install --global Pomelo.Extensions.Caching.MySqlConfig.Tools --version 2.3.0
dotnet new tool-manifestif you are setting up this repo
dotnet tool install --local Pomelo.Extensions.Caching.MySqlConfig.Tools --version 2.3.0
#tool dotnet:?package=Pomelo.Extensions.Caching.MySqlConfig.Tools&version=2.3.0
nuke :add-package Pomelo.Extensions.Caching.MySqlConfig.Tools --version 2.3.0
👁 AppVeyor build status
👁 NuGet
Basing on https://learn.microsoft.com/en-us/aspnet/core/performance/caching/distributed and modified accordingly:
The Distributed MySQL Server Cache implementation (AddDistributedMySqlCache) allows the distributed cache to use a MySQL Server database as its backing store. To create a MySQL Server cached item table in a MySQL Server instance, you can use the dotnet-mysql-cache tool. The tool creates a table with the name and schema that you specify.
CLI tool (globally) can be done with
dotnet tool install --global Pomelo.Extensions.Caching.MySqlConfig.Tools
Now, create a table in MySQL Server by running the dotnet mysql-cache create command. Provide the MySQL Server connection string, instance (for example server=192.169.0.1), table name (for example, NewTableName) and optional database (for example, MyDatabaseName):
dotnet mysql-cache create "server=192.169.0.1;user id=userName;password=P4ssword123!;port=3306;database=MyDatabaseName;Allow User Variables=True" "NewTableName" --databaseName "MyDatabaseName"
A message is logged to indicate that the tool was successful:
Table and index were created successfully.
The table created by the dotnet-mysql-cache tool has the following schema:
An app should manipulate cache values using an instance of IDistributedCache, not any other.
The example snippet how to implement MySql Server cache in Program.cs:
builder.Services.AddDistributedMySqlCache(options =>
{
options.ConnectionString = builder.Configuration.GetConnectionString("DistCache_ConnectionString");
options.SchemaName = "MyDatabaseName"; //optional
options.TableName = "NewTableName"; //required
});
A ConnectionString (and optionally, SchemaName and TableName) are typically stored outside of source control (for example, stored by the Secret Manager or in appsettings.json/appsettings.{Environment}.json files). The connection string may contain credentials that should be kept out of source control systems.
One can use same technique as described in this section Use the distributed cache
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.3.0 | 169 | 2/12/2026 |
| 2.2.1 | 354 | 1/6/2025 |
| 2.2.0 | 509 | 5/17/2024 |
| 2.1.1 | 795 | 4/17/2023 |
| 2.1.0 | 1,061 | 12/6/2020 |
| 2.0.3 | 1,329 | 4/20/2020 |
| 2.0.2 | 925 | 2/26/2019 |
| 2.0.1 | 1,018 | 12/9/2018 |
| 2.0.0-final | 1,360 | 3/13/2018 |
| 1.0.0-preview2-final | 2,434 | 7/26/2017 |
| 1.0.0-preview1-final | 1,187 | 7/25/2017 |