mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 05:13:27 +08:00
Support RemoveDataCache by likeString
This commit is contained in:
parent
14820498f4
commit
6c85c49e4c
@ -238,7 +238,15 @@ namespace SqlSugar
|
||||
};
|
||||
return this;
|
||||
}
|
||||
|
||||
public IDeleteable<T> RemoveDataCache(string likeString)
|
||||
{
|
||||
this.RemoveCacheFunc = () =>
|
||||
{
|
||||
var cacheService = this.Context.CurrentConnectionConfig.ConfigureExternalServices.DataInfoCacheService;
|
||||
CacheSchemeMain.RemoveCache(cacheService, likeString);
|
||||
};
|
||||
return this;
|
||||
}
|
||||
public IDeleteable<T> In<PkType>(List<PkType> primaryKeyValues)
|
||||
{
|
||||
if (primaryKeyValues == null || primaryKeyValues.Count() == 0)
|
||||
|
@ -228,6 +228,15 @@ namespace SqlSugar
|
||||
};
|
||||
return this;
|
||||
}
|
||||
public IInsertable<T> RemoveDataCache(string likeString)
|
||||
{
|
||||
this.RemoveCacheFunc = () =>
|
||||
{
|
||||
var cacheService = this.Context.CurrentConnectionConfig.ConfigureExternalServices.DataInfoCacheService;
|
||||
CacheSchemeMain.RemoveCache(cacheService, likeString);
|
||||
};
|
||||
return this;
|
||||
}
|
||||
public MySqlBlueCopy<T> UseMySql()
|
||||
{
|
||||
return new MySqlBlueCopy<T>(this.Context, this.SqlBuilder, InsertObjs);
|
||||
|
@ -97,6 +97,15 @@ namespace SqlSugar
|
||||
};
|
||||
return this;
|
||||
}
|
||||
public IUpdateable<T> RemoveDataCache(string likeString)
|
||||
{
|
||||
this.RemoveCacheFunc = () =>
|
||||
{
|
||||
var cacheService = this.Context.CurrentConnectionConfig.ConfigureExternalServices.DataInfoCacheService;
|
||||
CacheSchemeMain.RemoveCache(cacheService,likeString);
|
||||
};
|
||||
return this;
|
||||
}
|
||||
public IUpdateable<T> IsEnableUpdateVersionValidation()
|
||||
{
|
||||
this.IsVersionValidation = true;
|
||||
|
@ -33,5 +33,23 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void RemoveCacheByLike(ICacheService cacheService, string likeString)
|
||||
{
|
||||
if (cacheService == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var keys = cacheService.GetAllKey<string>();
|
||||
if (keys.HasValue())
|
||||
{
|
||||
foreach (var item in keys)
|
||||
{
|
||||
if (item.ToLower().Contains(likeString))
|
||||
{
|
||||
cacheService.Remove<string>(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ namespace SqlSugar
|
||||
IDeleteable<T> WhereColumns(Expression<Func<T, object>> columns);
|
||||
IDeleteable<T> EnableDiffLogEvent(object businessData = null);
|
||||
IDeleteable<T> RemoveDataCache();
|
||||
IDeleteable<T> RemoveDataCache(string likeString);
|
||||
KeyValuePair<string, List<SugarParameter>> ToSql();
|
||||
void AddQueue();
|
||||
}
|
||||
|
@ -87,6 +87,7 @@ namespace SqlSugar
|
||||
IUpdateable<T> EnableDiffLogEvent(object businessData = null);
|
||||
IUpdateable<T> ReSetValue(Expression<Func<T, bool>> setValueExpression);
|
||||
IUpdateable<T> RemoveDataCache();
|
||||
IUpdateable<T> RemoveDataCache(string likeString);
|
||||
IUpdateable<T> CallEntityMethod(Expression<Action<T>> method);
|
||||
KeyValuePair<string,List<SugarParameter>> ToSql();
|
||||
void AddQueue();
|
||||
|
@ -36,6 +36,7 @@ namespace SqlSugar
|
||||
|
||||
IInsertable<T> EnableDiffLogEvent(object businessData = null);
|
||||
IInsertable<T> RemoveDataCache();
|
||||
IInsertable<T> RemoveDataCache(string likeString);
|
||||
KeyValuePair<string, List<SugarParameter>> ToSql();
|
||||
SqlServerBlueCopy UseSqlServer();
|
||||
MySqlBlueCopy<T> UseMySql();
|
||||
|
Loading…
Reference in New Issue
Block a user