mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 23:13:42 +08:00
Add RemoveDataCache
This commit is contained in:
parent
228db65a9a
commit
a2ad14b3bc
@ -49,7 +49,7 @@ namespace SqlSugar
|
||||
Task<bool> result = new Task<bool>(() =>
|
||||
{
|
||||
IDeleteable<T> asyncDeleteable = CopyDeleteable();
|
||||
return asyncDeleteable.ExecuteCommand()>0;
|
||||
return asyncDeleteable.ExecuteCommand() > 0;
|
||||
});
|
||||
result.Start();
|
||||
return result;
|
||||
@ -173,6 +173,14 @@ namespace SqlSugar
|
||||
DeleteBuilder.Parameters.AddRange(parameters);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IDeleteable<T> RemoveDataCache()
|
||||
{
|
||||
var cacheService = this.Context.CurrentConnectionConfig.ConfigureExternalServices.DataInfoCacheService;
|
||||
CacheSchemeMain.RemoveCache(cacheService, this.Context.EntityMaintenance.GetTableName<T>());
|
||||
return this;
|
||||
}
|
||||
|
||||
public IDeleteable<T> In<PkType>(List<PkType> primaryKeyValues)
|
||||
{
|
||||
if (primaryKeyValues == null || primaryKeyValues.Count() == 0)
|
||||
|
@ -184,6 +184,13 @@ namespace SqlSugar
|
||||
this.InsertBuilder.IsNoInsertNull = isNoInsertNull;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IInsertable<T> RemoveDataCache()
|
||||
{
|
||||
var cacheService = this.Context.CurrentConnectionConfig.ConfigureExternalServices.DataInfoCacheService;
|
||||
CacheSchemeMain.RemoveCache(cacheService, this.Context.EntityMaintenance.GetTableName<T>());
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Protected Methods
|
||||
|
@ -1032,7 +1032,7 @@ namespace SqlSugar
|
||||
var sqlObj = this.ToSql();
|
||||
if (IsCache)
|
||||
{
|
||||
var cacheService = this.Context.CurrentConnectionConfig.ConfigureExternalServices.DataInfoCache;
|
||||
var cacheService = this.Context.CurrentConnectionConfig.ConfigureExternalServices.DataInfoCacheService;
|
||||
result = CacheSchemeMain.GetOrCreate<List<TResult>>(cacheService, this.QueryBuilder, () => { return GetData<TResult>(sqlObj); }, CacheTime, this.Context);
|
||||
}
|
||||
else
|
||||
|
@ -174,6 +174,7 @@ namespace SqlSugar
|
||||
UpdateBuilder.WhereValues.Add(expResult.GetResultString());
|
||||
return this;
|
||||
}
|
||||
|
||||
public IUpdateable<T> With(string lockString)
|
||||
{
|
||||
if (this.Context.CurrentConnectionConfig.DbType == DbType.SqlServer)
|
||||
@ -181,6 +182,13 @@ namespace SqlSugar
|
||||
return this;
|
||||
}
|
||||
|
||||
public IUpdateable<T> RemoveDataCache()
|
||||
{
|
||||
var cacheService = this.Context.CurrentConnectionConfig.ConfigureExternalServices.DataInfoCacheService;
|
||||
CacheSchemeMain.RemoveCache(cacheService, this.Context.EntityMaintenance.GetTableName<T>());
|
||||
return this;
|
||||
}
|
||||
|
||||
internal void Init()
|
||||
{
|
||||
this.UpdateBuilder.TableName = EntityInfo.EntityName;
|
||||
|
@ -49,7 +49,7 @@ namespace SqlSugar
|
||||
set{ _SerializeService = value;}
|
||||
}
|
||||
|
||||
public ICacheService ReflectionInoCache
|
||||
public ICacheService ReflectionInoCacheService
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -61,7 +61,7 @@ namespace SqlSugar
|
||||
set{_ReflectionInoCache = value;}
|
||||
}
|
||||
|
||||
public ICacheService DataInfoCache
|
||||
public ICacheService DataInfoCacheService
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -272,7 +272,7 @@ namespace SqlSugar
|
||||
#region Cache
|
||||
public ICacheService GetReflectionInoCacheInstance()
|
||||
{
|
||||
return Context.CurrentConnectionConfig.ConfigureExternalServices.ReflectionInoCache;
|
||||
return Context.CurrentConnectionConfig.ConfigureExternalServices.ReflectionInoCacheService;
|
||||
}
|
||||
|
||||
public void RemoveCacheAll()
|
||||
|
@ -26,6 +26,7 @@ namespace SqlSugar
|
||||
IDeleteable<T> Where(string whereString, SugarParameter parameter);
|
||||
IDeleteable<T> Where(string whereString, SugarParameter[] parameters);
|
||||
IDeleteable<T> Where(string whereString, List<SugarParameter> parameters);
|
||||
IDeleteable<T> RemoveDataCache();
|
||||
KeyValuePair<string, List<SugarParameter>> ToSql();
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ namespace SqlSugar
|
||||
IUpdateable<T> IgnoreColumns(Expression<Func<T, object>> columns);
|
||||
IUpdateable<T> IgnoreColumns(Func<string, bool> ignoreColumMethod);
|
||||
IUpdateable<T> ReSetValue(Expression<Func<T, bool>> setValueExpression);
|
||||
IUpdateable<T> RemoveDataCache();
|
||||
KeyValuePair<string,List<SugarParameter>> ToSql();
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ namespace SqlSugar
|
||||
IInsertable<T> IgnoreColumns(Expression<Func<T, object>> columns);
|
||||
IInsertable<T> IgnoreColumns(Func<string,bool> ignoreColumMethod);
|
||||
IInsertable<T> Where(bool isInsertNull, bool isOffIdentity = false);
|
||||
IInsertable<T> RemoveDataCache();
|
||||
KeyValuePair<string, List<SugarParameter>> ToSql();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user