I have web app using a .net API with a controller Filter that gets the token and grabs the user out of the database every time. I am trying to eliminate the same database call, so I have used MemoryCache.
public ObjectCache cache = MemoryCache.Default;
// setting it, and only calling database again if cache is empty
cache.Set("cachedUser", userFromDB, policy);
My problem is I opened another browser and logged in as a different user and I can see the first user still being cached in the debugger. Is the debugger scope causing this to happen, or will multiple users on their own browser sessions each have their own cache object? I am unsure if user A will stay cached locally and User B will stay cached locally, or user A will stay cached and user B will be mistaken for User A.