public void EmptyAllTest() { //Saves the cache and pass it a timespan for expiration barrel.Add(key: url, data: monkeys, expireIn: TimeSpan.FromDays(1)); var cached = barrel.Get <IEnumerable <Monkey> >(url); Assert.IsNotNull(cached); barrel.EmptyAll(); cached = barrel.Get <IEnumerable <Monkey> >(url); Assert.IsNull(cached); }
public void SetCacheDirectoryAfterInitialize() { IBarrel barrel = null; var folder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); SetupBarrel(ref barrel); barrel.EmptyAll(); BarrelUtils.SetBaseCachePath(folder); }
public MonkeyCacheActiveDirectoryProvider(IActiveDirectoryProvider activeDirectoryProvider, string applicationId, double expiryLengthDays = 1.0, bool refresh = false) : base(activeDirectoryProvider) { Barrel.ApplicationId = applicationId; _barrel = Barrel.Current; _expiryLengthDays = expiryLengthDays; if (refresh) { _barrel.EmptyAll(); } else { _barrel.EmptyExpired(); } }
public void GetKeysTest() { barrel.EmptyAll(); var keysToStore = new[] { "One", "Two", "Three" }.OrderBy(x => x).ToArray(); foreach (var item in keysToStore) { barrel.Add(key: item, data: item, expireIn: TimeSpan.FromDays(1)); } var test1 = barrel.GetKeys(CacheState.Active | CacheState.Expired); var cachedKeys = barrel.GetKeys().OrderBy(x => x).ToArray(); Assert.IsNotNull(cachedKeys); Assert.IsTrue(cachedKeys.Any()); for (var i = 0; i < cachedKeys.Length; i++) { Assert.AreEqual(keysToStore[i], cachedKeys[i]); } }
public MainViewModel(INavigationService navigationService, IPageDialogService dialogService, IEventAggregator eventAggregator, IBarrel barrel, ITeamsService teamService) : base(navigationService, dialogService) { Title = "Main view"; _barrel = barrel; _teamService = teamService; _eventAggregator = eventAggregator; PanelCommand = new DelegateCommand(() => IsPanelVisible = !IsPanelVisible); ShowLoadingCommand = new DelegateCommand(async() => await ShowLoading()); GoToPlayersViewCommand = new DelegateCommand(async() => await GoToPlayersView()); ClearCacheCommand = new DelegateCommand(() => _barrel.EmptyAll()); CrashCommand = new DelegateCommand(async() => await Crash()); NavigateToDetailCommand = new DelegateCommand(async() => await NavigateToDetail()); SignInCommand = new DelegateCommand(async() => await SignIn()); SignOutCommand = new DelegateCommand(async() => await SignOut()); _eventAggregator.GetEvent <MyEvent>()?.Subscribe(async() => { await DialogService.DisplayAlertAsync("Notification", "Show notification", "Ok"); }); }
public void Teardown() { barrel?.EmptyAll(); }
public void EmptyAllMonkeys() { file.EmptyAll(); }
public Task Clear(CancellationToken cancellationToken = default) { _barrel.EmptyAll(); return(Task.CompletedTask); }
public Task <bool> RemoveAll() { _barrel.EmptyAll(); return(Task.FromResult(true)); }