tags:

views:

32

answers:

2

Is HttpRuntime Cache unique for each user in ASP.NET as well as the Sessions?

+2  A: 

No, the HttpRuntime Cache is stored on the server side, and is valid application-wide.

Dan Dumitru
Correct, but not because it's stored on the server side. Session data is also stored on the server side.
Guffa
@Guffa - Right, point taken.
Dan Dumitru
A: 

The cache isn't unique for each user as @Dan Dumitru said but you could use it in a fake unique way by specifying a unique string as part of the key for the cached data (username or user id from a table etc)...This does of course mean lots of things would be cached depending on usage...it would then be subject to all the usual cache scenarios

Function GetDataFromCache() As Object

    Return Cache.Item(String.Concat(My.User.Name, "SomeDataThatIsCachedForEachUser"))

End Function
davidsleeps
There is no point in manually calling `String.Concat`. Use the `+` operator.
SLaks
davidsleeps