diff --git a/Infrastructure/ZR.Infrastructure.csproj b/Infrastructure/ZR.Infrastructure.csproj index af69019..d2396b3 100644 --- a/Infrastructure/ZR.Infrastructure.csproj +++ b/Infrastructure/ZR.Infrastructure.csproj @@ -12,7 +12,6 @@ - diff --git a/ZR.Admin.WebApi/Program.cs b/ZR.Admin.WebApi/Program.cs index 8685327..6ebaf7c 100644 --- a/ZR.Admin.WebApi/Program.cs +++ b/ZR.Admin.WebApi/Program.cs @@ -3,7 +3,6 @@ using Infrastructure.Converter; using Microsoft.AspNetCore.DataProtection; using NLog.Web; using System.Text.Json; -using BloomFilter.CSRedis.Configurations; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Caching.Redis; using Microsoft.Extensions.Options; @@ -69,18 +68,6 @@ if (openRedis == "1") { RedisServer.Initalize(); builder.Services.AddSingleton(new CSRedisCache(RedisHelper.Instance)); - builder.Services.AddBloomFilter(setupAction => - { - setupAction.UseCSRedis(new FilterCSRedisOptions - { - Name = "Redis1", - RedisKey = "BloomFilter", - ConnectionStrings = new List - { - AppSettings.GetConfig("RedisServer:Cache") - } - }); - }); } diff --git a/ZR.ServiceCore/SqlSugar/SqlSugarCache.cs b/ZR.ServiceCore/SqlSugar/SqlSugarCache.cs index d83bd44..16ce939 100644 --- a/ZR.ServiceCore/SqlSugar/SqlSugarCache.cs +++ b/ZR.ServiceCore/SqlSugar/SqlSugarCache.cs @@ -1,39 +1,24 @@ -using BloomFilter; -using ZR.Infrastructure.Cache; +using ZR.Infrastructure.Cache; namespace ZR.ServiceCore.SqlSugar { public class SqlSugarCache : ICacheService { - private readonly IBloomFilter _bloomFilter; - - public SqlSugarCache(IBloomFilter bloomFilter) - { - _bloomFilter = bloomFilter; - } - public void Add(string key, V value) { RedisServer.Cache.Set(key, value, 3600 + RedisHelper.RandomExpired(5, 30)); // CacheHelper.SetCache(key, value); - _bloomFilter.Add(key); } public void Add(string key, V value, int cacheDurationInSeconds) { RedisServer.Cache.Set(key, value, cacheDurationInSeconds); // CacheHelper.SetCaches(key, value, cacheDurationInSeconds); - _bloomFilter.Add(key); } public bool ContainsKey(string key) { - if (_bloomFilter.Contains(key)) - { - return RedisServer.Cache.Exists(key); - } - - return false; + return RedisServer.Cache.Exists(key); // return CacheHelper.Exists(key); } diff --git a/ZR.ServiceCore/SqlSugar/SqlSugarSetup.cs b/ZR.ServiceCore/SqlSugar/SqlSugarSetup.cs index 0e2fdcf..fea608a 100644 --- a/ZR.ServiceCore/SqlSugar/SqlSugarSetup.cs +++ b/ZR.ServiceCore/SqlSugar/SqlSugarSetup.cs @@ -1,5 +1,4 @@ -using BloomFilter; -using Infrastructure; +using Infrastructure; using Infrastructure.Model; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; @@ -36,8 +35,7 @@ namespace ZR.ServiceCore.SqlSugar }); } SugarIocServices.AddSqlSugar(iocList); - var provider = services.BuildServiceProvider(); - ICacheService cache = new SqlSugarCache(provider.GetService()); + ICacheService cache = new SqlSugarCache(); SugarIocServices.ConfigurationSugar(db => { var u = App.User;