ASP.NET Core 3.0 缓存(Cache)之 SQL Server 、Redis、MySQL、MemoryCache缓存


ASP.NET Core 3.0 缓存(Cache)之 SQL Server 缓存

ASP.NET Core 3.0 缓存(Cache)之 Redis 缓存

ASP.NET Core 3.0 缓存(Cache)之 MySQL 缓存

ASP.NET Core 3.0 缓存(Cache)之内存缓存(Memory Cache)

--sql server
dotnet tool install --global dotnet-sql-cache
dotnet sql-cache create "Server=192.168.0.44;User Id=sa;Password=1234;Database=Program_Test;" dbo AspNetCoreCache

--mysql
dotnet tool install --global Pomelo.Extensions.Caching.MySqlConfig.Tools --version 2.0.2
dotnet mysql-cache create "Server=192.168.0.82;User Id=sa;Password=1234;Database=program_test;Port=13306;default command timeout=100;Connection Timeout=30;Charset=utf8;" dbo AspNetCoreCache

sqlserver:

 1 -- ----------------------------
 2             -- Table structure for AspNetCoreCache
 3             -- ----------------------------
 4             DROP TABLE [dbo].[AspNetCoreCache]
 5             GO
 6             CREATE TABLE [dbo].[AspNetCoreCache] (
 7                 [Id] nvarchar(449) NOT NULL ,
 8                 [Value] varbinary(MAX) NOT NULL ,
 9                 [ExpiresAtTime] datetimeoffset(7) NOT NULL ,
10                 [SlidingExpirationInSeconds] bigint NULL ,
11                 [AbsoluteExpiration] datetimeoffset(7) NULL 
12             )
13 
14             GO
15 
16             -- ----------------------------
17             -- Indexes structure for table AspNetCoreCache
18             -- ----------------------------
19             CREATE INDEX [Index_ExpiresAtTime] ON [dbo].[AspNetCoreCache]
20             ([ExpiresAtTime] ASC) 
21             GO
22 
23             -- ----------------------------
24             -- Primary Key structure for table AspNetCoreCache
25             -- ----------------------------
26             ALTER TABLE [dbo].[AspNetCoreCache] ADD PRIMARY KEY ([Id])
27             GO 
Sql Server

mysql:

 1 SET FOREIGN_KEY_CHECKS=0;
 2 
 3             -- ----------------------------
 4             -- Table structure for aspnetcorecache
 5             -- ----------------------------
 6             DROP TABLE IF EXISTS `aspnetcorecache`;
 7             CREATE TABLE `aspnetcorecache` (
 8                 `Id` varchar(449) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
 9                 `AbsoluteExpiration` datetime(6) DEFAULT NULL,
10                 `ExpiresAtTime` datetime(6) NOT NULL,
11                 `SlidingExpirationInSeconds` bigint(20) DEFAULT NULL,
12                 `Value` longblob NOT NULL,
13                 PRIMARY KEY (`Id`),
14                 KEY `Index_ExpiresAtTime` (`ExpiresAtTime`)
15             ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
MySql