Differences Session data is stored at the user level but caching data is stored at the application level and shared by all the users. Sessions may not improve performance whereas Cache will improve site performance. Cache won’t maintain any state, whereas Sessions will maintain separate states for every user.

Catching techniques of three types

  • Page Caching
  • Action Caching
  • Fragment Caching

Page Caching

Page caching is the rail mechanism which allows the request for a generated page to be fulfilled by the webserver

Action Caching

Caching works like Page Caching except the incoming web request hits the Rails stack so that before filters can be run on it before the cache is served. This allows authentication and other restrictions to be run while still serving the result of the output from a cached copy.

Fragment Caching

When different parts of the page need to be cached and expired separately you can use Fragment Caching.

 session cache

The session key stored with the client is a locator index to the associated session data stored in the Website session cache. The Website session cache stores, among other data, the credential information obtained for each client. The SSL session cache stores the SSL session ID used to maintain the SSL session state.

Session Memory

The database server uses the virtual portion of shared memory mainly for user sessions. The majority of the memory that each user session allocates is for SQL statements. The amount of used memory can vary from one statement to another.

A session is of three types

  • in-process session
  • out Process session
  • SQL-server session