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
2010-09-12 22:00:12
Correct, but not because it's stored on the server side. Session data is also stored on the server side.
Guffa
2010-09-12 22:03:08
@Guffa - Right, point taken.
Dan Dumitru
2010-09-12 22:05:32
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
2010-09-12 23:40:11
There is no point in manually calling `String.Concat`. Use the `+` operator.
SLaks
2010-09-13 01:00:50
davidsleeps
2010-09-13 01:05:14