簡體   English   中英

覆蓋 DistributedMemoryCache 以使用 DistributedSQLCache

[英]Overriding DistributedMemoryCache to Use DistributedSQLCache

我有一個使用 DistributedMemoryCache 的 aspnet core 2.2 應用程序,我想將其更改為 DistributedSQLCache,而不需要重新編譯和更改該應用程序(它已經編譯),所以我想向它添加一個插件(它有一個插件系統)來更改從內存緩存到 SQL 緩存的緩存。 這可能嗎,例如通過調用 ConfigureServices? 我試過這個無濟於事:

public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
        {
            services.AddSession();
            services.AddDistributedSqlServerCache(options =>
            {
                options.ConnectionString =
                   "Data Source=etcetc....";
                options.SchemaName = "dbo";
                options.TableName = "TestCache";
            });

            services.AddMvc();

            
        }

我怎樣才能做到這一點? 我想利用 SQL 服務器緩存在此應用程序上運行適當的網絡花園和網絡農場。

NopCommerce 目前支持 Memory、SqlServer 和 Redis 作為緩存類型 OTB。

為了替換您通常會在 ConfigureServices 方法中找到的此元素或任何其他元素,您需要在插件中為INopStartup提供自定義實現。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM