Hello all i am new to Asp.Net could anyone tell me what is the difference between cache and session in real time.
Session: Session is used to store data,It is user specific. It can be accessible through out the site. Session has 4 modes:
Example:
Session["key"] = "value"; // You can store any object data type.
Cache: There are two types of cache in asp.net.
Application Caching: It allows to store any object in memory and automatically removed the object based on some limitations e.g time or some other dependencies . Example:
Cache["key"] = "value"; // it also supports any object data type.
Remember Cache and Session are different things.
A Session is available for a user till the application is alive and the session is not abandoned.
Well a cache can be made available for the enitre application level or user level
One major difference between both is that you items in cache can expire after given time to cahce well as items in session will stay till session expires
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With