mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2026-02-05 16:09:49 +08:00
【优化】移除EasyCaching.Core,EasyCaching.CSRedis,EasyCaching.InMemory等组件,直接使用原生CSRedis组件,替换SqlSugar二级缓存组件。
This commit is contained in:
@@ -4,21 +4,16 @@ using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Loging;
|
||||
using Essensoft.Paylink.Alipay;
|
||||
using Essensoft.Paylink.WeChatPay;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog.Web;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using CoreCms.Net.Auth;
|
||||
using CoreCms.Net.Core.AutoFac;
|
||||
using CoreCms.Net.Core.Config;
|
||||
@@ -27,7 +22,6 @@ using CoreCms.Net.Mapping;
|
||||
using CoreCms.Net.Middlewares;
|
||||
using CoreCms.Net.Swagger;
|
||||
using CoreCms.Net.Utility;
|
||||
using EasyCaching.Core;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
@@ -132,27 +126,6 @@ YitIdHelper.SetIdGenerator(options);
|
||||
// 初始化以后,即可在任何需要生成ID的地方,调用以下方法:
|
||||
//var newId = YitIdHelper.NextId();
|
||||
|
||||
|
||||
#region 缓存配置
|
||||
string cacheProviderName = "default";
|
||||
builder.Services.AddEasyCaching(options =>
|
||||
{
|
||||
////使用文档 https://easycaching.readthedocs.io/en/latest
|
||||
if (AppSettingsConstVars.RedisUseCache)
|
||||
{
|
||||
options.UseCSRedis(builder.Configuration);
|
||||
cacheProviderName = EasyCachingConstValue.DefaultCSRedisName;
|
||||
}
|
||||
else
|
||||
{
|
||||
cacheProviderName = EasyCachingConstValue.DefaultInMemoryName;
|
||||
options.UseInMemory(builder.Configuration);
|
||||
}
|
||||
options.WithJson(cacheProviderName);
|
||||
|
||||
});
|
||||
#endregion
|
||||
|
||||
#region AutoFac注册============================================================================
|
||||
|
||||
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
|
||||
@@ -199,8 +172,6 @@ app.UseRequestResponseLog();
|
||||
app.UseRecordAccessLogsMildd(GlobalEnumVars.CoreShopSystemCategory.Admin.ToString());
|
||||
// 记录ip请求 (注意开启权限,不然本地无法写入)
|
||||
app.UseIpLogMildd();
|
||||
//注册csredis中间件处理
|
||||
Storage.Container = app.Services.CreateScope().ServiceProvider.GetAutofacRoot();
|
||||
#endregion
|
||||
|
||||
app.UseSwagger().UseSwaggerUI(c =>
|
||||
|
||||
Reference in New Issue
Block a user