refactor: 重构代码删除 CacheKeyChangeToken

This commit is contained in:
Argo-Tianyi 2022-01-14 23:30:51 +08:00
parent 8ec06d9199
commit 0e64331bc3
2 changed files with 7 additions and 39 deletions

View File

@ -1,31 +0,0 @@
using Microsoft.Extensions.Primitives;
namespace BootstrapAdmin.Caching;
/// <summary>
/// 缓存键值 IChangeToken 实现类
/// </summary>
public class CacheKeyChangeToken : IChangeToken
{
/// <summary>
///
/// </summary>
public bool HasChanged { get; }
/// <summary>
///
/// </summary>
public bool ActiveChangeCallbacks { get; }
/// <summary>
///
/// </summary>
/// <param name="callback"></param>
/// <param name="state"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public IDisposable RegisterChangeCallback(Action<object> callback, object state)
{
throw new NotImplementedException();
}
}

View File

@ -261,7 +261,7 @@ class DictService : IDict
public bool GetAppSiderbar()
{
var dicts = GetAll();
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "侧边栏状态" && s.Define == EnumDictDefine.System)?.Code == "1" ? true : false;
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "侧边栏状态" && s.Define == EnumDictDefine.System)?.Code == "1";
}
public bool SaveAppSiderbar(bool value) => SaveDict(new Dict { Category = "网站设置", Name = "侧边栏状态", Code = value ? "1" : "0" });
@ -269,7 +269,7 @@ class DictService : IDict
public bool GetAppTitle()
{
var dicts = GetAll();
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "卡片标题状态" && s.Define == EnumDictDefine.System)?.Code == "1" ? true : false;
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "卡片标题状态" && s.Define == EnumDictDefine.System)?.Code == "1";
}
public bool SaveAppTitle(bool value) => SaveDict(new Dict { Category = "网站设置", Name = "卡片标题状态", Code = value ? "1" : "0" });
@ -277,7 +277,7 @@ class DictService : IDict
public bool GetAppFixHeader()
{
var dicts = GetAll();
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "固定表头" && s.Define == EnumDictDefine.System)?.Code == "1" ? true : false;
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "固定表头" && s.Define == EnumDictDefine.System)?.Code == "1";
}
public bool SaveAppFixHeader(bool value) => SaveDict(new Dict { Category = "网站设置", Name = "固定表头", Code = value ? "1" : "0" });
@ -285,7 +285,7 @@ class DictService : IDict
public bool GetAppHealthCheck()
{
var dicts = GetAll();
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "健康检查" && s.Define == EnumDictDefine.System)?.Code == "1" ? true : false;
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "健康检查" && s.Define == EnumDictDefine.System)?.Code == "1";
}
public bool SaveAppHealthCheck(bool value) => SaveDict(new Dict { Category = "网站设置", Name = "健康检查", Code = value ? "1" : "0" });
@ -293,7 +293,7 @@ class DictService : IDict
public bool GetAppMobileLogin()
{
var dicts = GetAll();
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "短信验证码登录" && s.Define == EnumDictDefine.System)?.Code == "1" ? true : false;
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "短信验证码登录" && s.Define == EnumDictDefine.System)?.Code == "1";
}
public bool SaveAppMobileLogin(bool value) => SaveDict(new Dict { Category = "网站设置", Name = "短信验证码登录", Code = value ? "1" : "0" });
@ -301,7 +301,7 @@ class DictService : IDict
public bool GetAppOAuthLogin()
{
var dicts = GetAll();
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "OAuth 认证登录" && s.Define == EnumDictDefine.System)?.Code == "1" ? true : false;
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "OAuth 认证登录" && s.Define == EnumDictDefine.System)?.Code == "1";
}
public bool SaveAppOAuthLogin(bool value) => SaveDict(new Dict { Category = "网站设置", Name = "OAuth 认证登录", Code = value ? "1" : "0" });
@ -309,7 +309,7 @@ class DictService : IDict
public bool GetAutoLockScreen()
{
var dicts = GetAll();
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "自动锁屏" && s.Define == EnumDictDefine.System)?.Code == "1" ? true : false;
return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "自动锁屏" && s.Define == EnumDictDefine.System)?.Code == "1";
}
public bool SaveAutoLockScreen(bool value) => SaveDict(new Dict { Category = "网站设置", Name = "自动锁屏", Code = value ? "1" : "0" });
@ -378,7 +378,6 @@ class DictService : IDict
public bool SaveLoginExpired(int value) => SaveDict(new Dict { Category = "网站设置", Name = "登录日志保留时长", Code = value.ToString() });
public int GetAccessExpired()
{
var dicts = GetAll();