2.0: Cache vs Session

  • Thread starter Thread starter RAM
  • Start date Start date
R

RAM

Hello,
I am learning .NET, ASP.NET 2.0. I would like to ask you a question: when to
use Cache["x"], when to use Session["x"]? If I have multiuser application
can I use Cache["x"] to keep some value separately for each user logged in?
Thank you.
/RAM/
 
Session is designed for user-specific items - things that pertain to the
current user of your app only.

Cache is for more general items that would apply to all users of your app.
Cache also offers more expiration options and callbacks as well.
Peter
 
Cache is normally used to store items accessed across the application.
i.e; across multiple sessions.. But where as the Session is used to
store the session specific data.

For your question, the answer is NO, the value of Cache["x"], will be
same across different sessions
 
Back
Top