asp.net mvc - Caching user data to avoid excess database trips -
after creating proof of concept asp.net mvc site , making sure appropriate separation of concerns in place, noticed making lot of expensive redundant database calls information current user.
being historically desktop , services person, first thought cache db results in static
s. didn't take searching see doing persist current user's data across whole appdomain users.
next thought of using httpcontext.current
. however, if put stuff here when user logged out, when log in cached data out of date. update every time login/logout occurs can't tell if feels right. in absence of other ideas, i'm leaning.
what lightweight way accurately cache user details , avoid having make tons of database calls?
if information want cache per-user , while active, session right place.
http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.aspx
Comments
Post a Comment