简体   繁体   中英

Can I use In-Memory Engine for SQL Server Distributed Cache in ASP.NET Core?

I'm currently using a Distributed SQL Server Cache in ASP.NET Core.

The Distributed SQL Server Cache implementation ( AddDistributedSqlServerCache ) allows the distributed cache to use a SQL Server database as its backing store.

For documentation click here

I used the following method:

services.AddDistributedSqlServerCache(options =>
{
    options.ConnectionString = 
        _config["DistCache_ConnectionString"];
    options.SchemaName = "dbo";
    options.TableName = "MyDiskBasedTable";
});

Can I create database objects using AddDostributedSqlServerCache implementation in order to use In-Memory Engine (In-Memory Tables, Natively Compiled Stored Procedures, memory-optimized table type) for best performances?

The table that is created by dotnet sql-cache create has a clusterd primary key and uses datetimeoffset both of them are not supported when creating in-memory OLTP tables.

Although there is a PR for this in the repository.

You could use his fork, although saving datetimeoffest as varchar is not the recommend way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM