2.0: Cache vs Session

Discussion in 'ASP .Net' started by RAM, Aug 14, 2006.

  1. RAM

    RAM Guest

    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, Aug 14, 2006
    1. Advertisements

  2. RAM

    Guest Guest

    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.
    Guest, Aug 14, 2006
    1. Advertisements

  3. RAM

    Kumar Reddi Guest

    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
    Kumar Reddi, Aug 14, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.