SiteMap  | About    

Difference Between Session and Caching

What is Caching?

Caching is a technique where we can store frequently used data, and web pages are stored temporarily on the local hard disk for later retrieval. Each request will use the same cache for different users. One of the more common items stored in a cache in a Web application environment is commonly displayed database values ; by caching such information, rather than relying on repeated database calls, the demand on the Web server and database server's system resources are decreased and the Web application's scalability increased.

What is session?

Session is a period of time that is shared between the web application and the user. It refers to a limited time of communication between two systems. Some sessions involve a client and server, while other sessions involve two personal computers. Each user that is using the web application has their own session . Session variables will use different session variables for each different user. Since session variables are stored on the Web server's memory, storing large objects in a user's session on a site with many simultaneous users can lead to reduced memory on the Web server


  1. Session data is stored at the user level but caching data is stored at the application level and shared by all the users.

  2. Sessions may not improve performance whereas Cache will improve site performance.

  3. Items in cache can expire after given time to cache while items in session will stay till session expires.

  4. Sessions may change from user to user whereas a single Cache will be maintained for the entire application.

  5. Cache wont maintain any state, whereas Sessions will maintain separate state for every user. (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.