Advantages of Cache vs Session

One important difference is, that items in the cache can expire (will be removed from cache) after a specified amount of time. Items put into a session will stay there, until the session ends.

ASP.NET can also remove items from cache when the amount of available memory gets small.

Another difference: the session state can be kept external (state server, SQL server) and shared between several instances of your web app (for load balancing). This is not the case with the cache.

Besides of these differences (as others have noted): session is per user/session while cache is per application.

Leave a Comment