/// <summary> /// 清空单个表相关的所有缓存 /// </summary> public void FlushCurrentCollectionCache(string collectionName = null) { if (DbContext.OpenQueryCache) { QueryCacheManager.FlushCollectionCache(collectionName); } if (DbContext.OpenTableCache) { TableCacheManager.FlushCollectionCache(collectionName); } }
internal void Update <TEntity>(TEntity entity, Expression <Func <TEntity, bool> > filter) { //1.清空Query缓存中关于该表的所有缓存记录 if (DbContext.OpenQueryCache) { QueryCacheManager.FlushCollectionCache(); } //2.更新Table缓存中的该表记录 if (DbContext.OpenTableCache) { TableCacheManager.UpdateCache(entity, filter); } }
internal void Add <TEntity>(IEnumerable <TEntity> entities) { //1.清空Query缓存中关于该表的所有缓存记录 if (DbContext.OpenQueryCache) { QueryCacheManager.FlushCollectionCache(); } //2.更新Table缓存中的该表记录 if (DbContext.OpenTableCache) { TableCacheManager.AddCache(entities); } }
internal void Delete <TEntity>(TEntity entity) { //1.清空Query缓存中关于该表的所有缓存记录 if (DbContext.OpenQueryCache) { QueryCacheManager.FlushCollectionCache(); } //2.更新Table缓存中的该表记录 if (DbContext.OpenTableCache) { TableCacheManager.DeleteCache(entity); } }