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