/// <summary> /// 清空所有缓存 /// </summary> public void FlushAllCache() { if (CacheStorageManager.IsExist(CachingConst.GetTableCacheKeysCacheKey(DbContext.DataBaseName), out HashSet <string> keys)) { foreach (var item in keys) { CacheStorageManager.Delete(item); } } }
private string GetTableCacheKey(string collectionName = null) { string key = $"{CachingConst.CacheKey_TableCache}_{DbContext.DataBaseName}_{collectionName ?? DbContext.CollectionName}"; //缓存键更新 if (!CacheStorageManager.IsExist(CachingConst.GetTableCacheKeysCacheKey(DbContext.DataBaseName), out HashSet <string> keys)) { keys = new HashSet <string>(); } keys.Add(key); CacheStorageManager.Put(CachingConst.GetTableCacheKeysCacheKey(DbContext.DataBaseName), keys, CacheOptions.MaxExpiredTimeSpan); return(key); }