Last active
May 2, 2024 21:52
-
-
Save ChrisMoney/0562b6627313f623f9e075341dda3896 to your computer and use it in GitHub Desktop.
Cache DB Call
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
if (HttpContext.Current.Cache.Get("ef_results") == null) | |
{ | |
var results = null; // todo: get results from EF | |
HttpContext.Current.Cache.Add("ef_results", // cache key | |
results, // cache value | |
null, // dependencies | |
System.Web.Caching.Cache.NoAbsoluteExpiration, // absolute expiration | |
TimeSpan.FromMinutes(30)); // sliding expiration | |
} | |
myDropDown.DataSource = HttpContext.Current.Cache.Get("ef_results"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment