mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 20:03:26 +08:00
【新增】新增【EasyCaching.CSRedis】redis组件,替换SqlSugar二级缓存的【StackExchange.Redis】组件实现,使用异步替代同步处理二级缓存,解决【StackExchange.Redis】超过200并发后的异常情况。异步提升二级缓存获取效率。
【新增】appsetting.json配置文件增加【AppPcUrl】PC端访问地址,【AppH5Url】H5端访问地址,方便对接pc端、h5端、微信公众号端。
This commit is contained in:
@@ -12,7 +12,9 @@ using CoreCms.Net.Mapping;
|
||||
using CoreCms.Net.Middlewares;
|
||||
using CoreCms.Net.Swagger;
|
||||
using CoreCms.Net.Task;
|
||||
using CoreCms.Net.Utility;
|
||||
using CoreCms.Net.WeChat.Service.Mediator;
|
||||
using EasyCaching.Core;
|
||||
using Essensoft.Paylink.Alipay;
|
||||
using Essensoft.Paylink.WeChatPay;
|
||||
using Hangfire;
|
||||
@@ -142,6 +144,25 @@ YitIdHelper.SetIdGenerator(options);
|
||||
//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注册============================================================================
|
||||
|
||||
@@ -189,6 +210,8 @@ app.UseRequestResponseLog();
|
||||
app.UseRecordAccessLogsMildd(GlobalEnumVars.CoreShopSystemCategory.Api.ToString());
|
||||
// 记录ip请求 (注意开启权限,不然本地无法写入)
|
||||
app.UseIpLogMildd();
|
||||
//注册csredis中间件处理
|
||||
Storage.Container = app.Services.CreateScope().ServiceProvider.GetAutofacRoot();
|
||||
#endregion
|
||||
|
||||
//强制显示中文
|
||||
|
||||
Reference in New Issue
Block a user