-
-
Save csharpfritz/66e206f3e003d639ef64dacb42f6f391 to your computer and use it in GitHub Desktop.
ASP.NET Core Distributed Cache usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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