Skip to content

Instantly share code, notes, and snippets.

@csharpfritz
Created June 27, 2016 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csharpfritz/66e206f3e003d639ef64dacb42f6f391 to your computer and use it in GitHub Desktop.
Save csharpfritz/66e206f3e003d639ef64dacb42f6f391 to your computer and use it in GitHub Desktop.
ASP.NET Core Distributed Cache usage
public HomeController(IDistributedCache cache) {
this.Cache = cache;
}
public IDistributedCache Cache { get; private set; }
public IActionResult Index() {
ViewBag.CachedValue = Cache.Get("myCacheKey");
return View();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment