/// <summary> /// 移除清除缓存数据委托 /// </summary> /// <param name="clearCache"></param> /// <returns>false 表示没有找到委托</returns> public static bool RemoveClearCache(Action clearCache) { ReferenceHashKey <Action> hashKey = new ReferenceHashKey <Action>(clearCache); clearCacheLock.EnterSleep(); try { return(clearCaches.Remove(hashKey)); } finally { clearCacheLock.Exit(); } }
/// <summary> /// 添加清除缓存数据委托 /// </summary> /// <param name="clearCache"></param> /// <returns>false 表示已经添加过,无需重复添加</returns> public static bool AddClearCache(Action <int> clearCache) { ReferenceHashKey <Action <int> > hashKey = new ReferenceHashKey <Action <int> >(clearCache); clearCacheLock.EnterSleep(); try { return(clearCountCaches.Add(hashKey)); } finally { clearCacheLock.Exit(); } }