コード例 #1
0
 public ActionResult Currency()
 {
     var cache = MemoryCache.Default;
     var currencyModel = cache.Get("Currency");
     if (currencyModel == null)
     {
         currencyModel = new CurrencyModel();
     }
     return View(currencyModel);
 }
コード例 #2
0
 public ActionResult Currency(CurrencyModel model)
 {
     if (ModelState.IsValid)
     {
         var cache = MemoryCache.Default;
         cache.Remove("Currency");
         cache.Add("Currency", model, DateTimeOffset.UtcNow.AddMinutes(8000));
     }
     return View(model);
 }