-
Notifications
You must be signed in to change notification settings - Fork 4
Caching
Max Stepanskiy edited this page Oct 31, 2020
·
31 revisions
L1 cache is a "session" based, short lived, non persistent and not shared cache.
The content lives in the memory of the executing thread; however some setup is required for ASP.NET applications unless custom implementation of IExecutionContext is provided.
// HttpApplication.PostAuthenticateRequest event handler in ASP.NET (this setup is different for ASP.NET Core)
protected void Application_OnPostAuthenticateRequest(object sender, EventArgs e)
{
Thread.CurrentPrincipal = new HttpContextPrincipal(Thread.CurrentPrincipal)
HttpContext.Current.User = new HttpContextPrincipal(HttpContext.Current.User)
}Although L1 cache type can be configured globally, it can also be enabled/disabled for a specific data retrieval method (such as Retrieve or Select) as all of them expose cached parameter which is set to null by default.