private async Task LoadCache() { Progress.IsIndeterminate = false; Progress.Value = 0; Status.Text = Text.Loading; Cancel.Visibility = Visibility.Hidden; Hint.Visibility = Visibility.Visible; WebCache.Init(); if (WebCache.CacheGameVersion != await Riot.GetLatestVersionAsync() || WebCache.CacheLocale != CultureInfo.CurrentCulture.Name) { LogTo.Info("Clearing web cache due to a new LoL version being available, or a language change"); WebCache.Clear(); WebCache.CacheGameVersion = await Riot.GetLatestVersionAsync(); WebCache.CacheLocale = CultureInfo.CurrentCulture.Name; } Riot.SetLanguage(Config.Current.Culture); await Riot.CacheAllAsync(o => Dispatcher.Invoke(() => Progress.Value = o * 0.7)); await TeamGuesser.Load(new Progress <float>(o => Dispatcher.Invoke(() => Progress.Value = 0.7 + (o * 0.3)))); }
/// <summary> /// 清除统计、缓存 /// </summary> public static void Clear() { foreach (var item in DataStatisticsList) { WebCache.Clear(item.Key); } DataStatisticsList.Clear(); }
/// <summary> /// 清除缓存 /// </summary> public virtual void ClearCache() { try { // 删除缓存关键字对应的Key WebCache.Remove(CacheKey); //清除带这个key为前缀的所有缓存 WebCache.Clear(CacheKey); // 清除所有以缓存关键字开头的Key WebCache.Clear(CacheKey); } catch (Exception ex) { new Exceptions(ex); } }
public void Teardown() { var cache = new WebCache(); cache.Clear(); }
public void Setup() { var cache = new WebCache(); cache.Clear(); }