public ActionResult ClearCache() { var cacheManager = new MemoryCacheManager(); cacheManager.Clear(); return RedirectToAction("Index", "Home"); }
public ActionResult ClearCache() { var cacheManager = new MemoryCacheManager(); cacheManager.Clear(); return(RedirectToAction("Index", "Home")); }
public void Can_clear_cache() { _cacheManager.Set(new CacheKey("some_key_1"), 3); _cacheManager.Clear(); _cacheManager.IsSet(new CacheKey("some_key_1")).Should().BeFalse(); }
public void CanClearCache() { _staticCacheManager.Set(new CacheKey("some_key_1"), 3); _staticCacheManager.Clear(); _staticCacheManager.IsSet(new CacheKey("some_key_1")).Should().BeFalse(); }
public void Can_clear_cache() { _cacheManager.Set("some_key_1", 3, int.MaxValue); _cacheManager.Clear(); _cacheManager.IsSet("some_key_1").ShouldEqual(false); }
public void Can_clear_cache() { var cacheManager = new MemoryCacheManager(); cacheManager.Set("some_key_1", 3, int.MaxValue); cacheManager.Clear(); cacheManager.IsSet("some_key_1").ShouldEqual(false); }
public void ClearTest(string key, string region) { _manager.Set(key, new object(), region: region); Assert.NotNull(_manager.Get(key, region)); _manager.Clear(); Assert.Null(_manager.Get(key, region)); }
public void Can_clear_cache() { var cacheManager = new MemoryCacheManager(); cacheManager.Set("some_key_1", 3, int.MaxValue); cacheManager.Clear(); cacheManager.IsSet("some_key_1").ShouldEqual(false); }
public ActionResult ClearCache() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance)) return AccessDeniedView(); var cacheManager = new MemoryCacheManager(); cacheManager.Clear(); return RedirectToAction("Index", "Home"); }
public void Can_clear_cache() { var cacheManager = new MemoryCacheManager(new MemoryCache(new MemoryCacheOptions())); cacheManager.Set("some_key_1", 3, int.MaxValue); cacheManager.Clear(); Assert.True(cacheManager.IsSet("some_key_1") == false); }
public void PassesMemoryCacheManager_Clear_Success() { _cacheManager.Set("key1", "value1", int.MaxValue); _cacheManager.Set("key2", "value2", int.MaxValue); _cacheManager.HasKey("key1").TestBeTrue(); _cacheManager.HasKey("key2").TestBeTrue(); _cacheManager.Clear(); _cacheManager.HasKey("key1").TestBeFalse(); _cacheManager.HasKey("key2").TestBeFalse(); }
public void ClearExample1() { ICacheManager cacheManager = new MemoryCacheManager(); string inputString = Console.ReadLine(); const string cacheKey = "MyKey"; const double saveHours = 1; cacheManager.SetByAbsolute(cacheKey, inputString, saveHours); cacheManager.Clear(); }
public void Can_clear_cache() { var cacheManager = new MemoryCacheManager(new MemoryCache(new MemoryCacheOptions())); cacheManager.Set("key_1", 1, int.MaxValue); cacheManager.Clear(); cacheManager.IsSet("key_1").ShouldEqual(false); }
public void CanOverwriteExistingItemsInCache() { var cacheManager = new MemoryCacheManager(); cacheManager.Clear(); cacheManager.Set("some_key_1", 3, int.MaxValue); cacheManager.Set("some_key_1", 99, int.MaxValue); cacheManager.Get <int>("some_key_1").ShouldEqual(99); }
public ActionResult ClearCache() { var cacheManager = new MemoryCacheManager(); cacheManager.Clear(); // set this in the activity log activityService.InsertActivity(SystemActivityLogTypeNames.ClearCache, string.Empty, string.Empty); SuccessNotification("Application cache has been cleared."); return RedirectToRoute(SystemRouteNames.HomePage); }
public void MemoryCacheManager_Should_Contain_No_Values_When_Cleared() { ICacheManager cacheManager = new MemoryCacheManager(); cacheManager.Add("Test", "Dit is de waarde...", new CacheItemPolicy()); cacheManager.Add("Test2", "Dit is de tweede waarde...", new CacheItemPolicy()); cacheManager.Add("Test3", "Dit is de derde waarde...", new CacheItemPolicy()); cacheManager.Clear(); Assert.AreEqual(0, cacheManager.Count()); }
public void CanValidateWhetherObjectIsCached() { var cacheManager = new MemoryCacheManager(); cacheManager.Clear(); cacheManager.Set("some_key_1", 3, int.MaxValue); cacheManager.Set("some_key_2", 4, int.MaxValue); cacheManager.IsSet("some_key_1").ShouldEqual(true); cacheManager.IsSet("some_key_2").ShouldEqual(true); cacheManager.IsSet("some_key_3").ShouldEqual(false); }
public void clearing_whole_Cache() { MemoryCacheManager memoryCacheManager = new MemoryCacheManager(); memoryCacheManager.Set("exampleKey25", 5, int.MaxValue); memoryCacheManager.Set("exampleKey35", 5, int.MaxValue); Assert.IsTrue(memoryCacheManager.IsSet("exampleKey25")); Assert.IsTrue(memoryCacheManager.IsSet("exampleKey35")); memoryCacheManager.Clear(); Assert.IsFalse(memoryCacheManager.IsSet("exampleKey25")); Assert.IsFalse(memoryCacheManager.IsSet("exampleKey35")); }
public string ClearCache(string password) { string pwd = Sp.GetCurrentPassword(); if (password != pwd) { return("密码错误"); } else { var cacheManager = new MemoryCacheManager(); cacheManager.Clear(); return("ok"); } }
public async Task Clearing_whole_Cache() { MemoryCacheManager memoryCacheManager = new MemoryCacheManager(new MemoryCache(new MemoryCacheOptions { })); await memoryCacheManager.SetAsync("exampleKey25", 5, int.MaxValue); await memoryCacheManager.SetAsync("exampleKey35", 5, int.MaxValue); Assert.IsTrue(memoryCacheManager.IsSet("exampleKey25")); Assert.IsTrue(memoryCacheManager.IsSet("exampleKey35")); await memoryCacheManager.Clear(); Assert.IsFalse(memoryCacheManager.IsSet("exampleKey25")); Assert.IsFalse(memoryCacheManager.IsSet("exampleKey35")); }
public ActionResult ClearCacheItem(string key) { if (string.IsNullOrEmpty(key)) { var cacheManager = new MemoryCacheManager(); cacheManager.Clear(); } else { var cacheManager = new MemoryCacheManager(); cacheManager.Remove(key); } return(RedirectToAction("Index", "Home")); }
public void CanSetAndGetObjectsFromCache() { var cacheManager = new MemoryCacheManager(); cacheManager.Clear(); // Ensure that simple objects can be cached cacheManager.Set("some_key_1", 3, int.MaxValue); cacheManager.Get <int>("some_key_1").ShouldEqual(3); // Ensure that collections can be cached cacheManager.Set("some_key_2", new List <int>() { 1, 2, 3 }, int.MaxValue); cacheManager.Get <List <int> >("some_key_2").ShouldNotBeNull(); cacheManager.Get <List <int> >("some_key_2").Count.ShouldEqual(3); }
public async Task Clearing_whole_Cache() { var eventPublisher = new Mock <IMediator>(); MemoryCacheManager memoryCacheManager = new MemoryCacheManager(new MemoryCache(new MemoryCacheOptions { }), eventPublisher.Object); await memoryCacheManager.SetAsync("exampleKey25", 5, int.MaxValue); await memoryCacheManager.SetAsync("exampleKey35", 5, int.MaxValue); Assert.IsTrue(memoryCacheManager.IsSet("exampleKey25")); Assert.IsTrue(memoryCacheManager.IsSet("exampleKey35")); await memoryCacheManager.Clear(); Assert.IsFalse(memoryCacheManager.IsSet("exampleKey25")); Assert.IsFalse(memoryCacheManager.IsSet("exampleKey35")); }
public ActionResult ClearCache(string returnUrl = "") { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance)) { return(AccessDeniedView()); } var cacheManager = new MemoryCacheManager(); cacheManager.Clear(); //home page if (String.IsNullOrEmpty(returnUrl)) { return(RedirectToAction("Index", "Home", new { area = "Admin" })); } //prevent open redirection attack if (!Url.IsLocalUrl(returnUrl)) { return(RedirectToAction("Index", "Home", new { area = "Admin" })); } return(Redirect(returnUrl)); }
public ActionResult ClearCache(string returnUrl = "") { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance)) return AccessDeniedView(); var cacheManager = new MemoryCacheManager(); cacheManager.Clear(); //home page if (String.IsNullOrEmpty(returnUrl)) return RedirectToAction("Index", "Home", new { area = "Admin" }); //prevent open redirection attack if (!Url.IsLocalUrl(returnUrl)) return RedirectToAction("Index", "Home", new { area = "Admin" }); return Redirect(returnUrl); }
public void CleanUp() { ICacheManager cacheManager = new MemoryCacheManager(); cacheManager.Clear(); }
/// <summary> /// Executes a task /// </summary> public void Execute() { var cacheManager = new MemoryCacheManager(); cacheManager.Clear(); }
/// <summary> /// Executes a task /// </summary> public void Execute() { var cacheManager = new MemoryCacheManager(); cacheManager.Clear(); }
public ActionResult ClearCache() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance)) return AccessDeniedView(); var cacheManager = new MemoryCacheManager(); cacheManager.Clear(); return RedirectToAction("Index", "Home"); }