我有下面的代码,并希望Duration
有[OutputCache(Duration = 10)]
一个变量值,以便我可以从集合中读取它DB
或从List
集合中读取它。
而且我希望能够在Duration
更改时立即重置服务器缓存。
更改时如何Duration
更改和重置缓存HTML
数据Duration
?这是我的代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Cache_Example.Controllers
{
public class HomeController : Controller
{
// GET: Home
// [OutputCache(Duration = 10)]
public ActionResult Index()
{
return View();
}
[OutputCache(Duration = 10)]
public ActionResult ShowDate()
{
return PartialView();
}
}
}