Kailas Gorane
Kailas Gorane

Reputation: 1

How cache reset on multiple users are logged-in

I have used cache in my ASP.net Mvc application like - [OutputCache(Duration=300, Location=Server)]

Supposed multiple users are logged-in and cache object is get fulled. Now if new user get logged-in then what will happen with cache object? Will system get slowed? or IIS will handle this scenario internally?

Upvotes: 0

Views: 149

Answers (1)

juunas
juunas

Reputation: 58733

EDIT: After clarification from OP, OutputCache is varied by userid so my original answer is not valid for this case. You can see it below.

In the case that OutputCache is varied by logged in userid, a separate object is kept in cache for each user. The flow goes like this:

User A hits app, result is cached and he will see it when he hits it the next time within 5 minutes.

If user B hits the app, regardless of other users' cached objects, the action will execute and the result is again cached.

Your solution is quite normal in the case where the output contains something that varies by the logged in user. New users hitting the app does not affect the existing objects in cache in any way.


The output of the action is cached for 5 minutes regardless who the user was.

So if user A hits the app first, the action will execute and result is cached.

Then user B hits it (within 5 minutes) and the server gives them the cached version.

Upvotes: 1

Related Questions