Is Page.Cache shared between all sessions?

Discussion in 'ASP .Net' started by Max2006, Aug 16, 2007.

  1. Max2006

    Max2006 Guest

    Hi,

    Is Page.Cache global and shared between all session? What would be the best
    way to cache an object and share it btween all sessions?
    I like to avoid Application object because it doesn't have Cache's
    flexibilities.

    Thank you,
    Max
     
    Max2006, Aug 16, 2007
    #1
    1. Advertising

  2. Max2006 wrote:
    > Hi,
    >
    > Is Page.Cache global and shared between all session?


    Yes.

    > What would be the best
    > way to cache an object and share it btween all sessions?
    > I like to avoid Application object because it doesn't have Cache's
    > flexibilities.
    >
    > Thank you,
    > Max
    >
    >



    --
    Göran Andersson
    _____
    http://www.guffa.com
     
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, Aug 16, 2007
    #2
    1. Advertising

  3. Yes,

    Cache should be shared around sessions (not sure in a farm of servers).

    If you want you can make a dummy test:
    - Add a Page cache of 30 minutes that read a value from a table in
    database
    - Open an IE an Access the page (it should be cached).
    - Modify that value from the DB
    - Open another IE sessions and you will get the page without the labe
    updated from the DB.

    HTH
    Braulio


    /// ------------------------------
    /// Braulio Diez
    ///
    /// http://www.tipsdotnet.com
    /// ------------------------------




    "Max2006" wrote:

    > Hi,
    >
    > Is Page.Cache global and shared between all session? What would be the best
    > way to cache an object and share it btween all sessions?
    > I like to avoid Application object because it doesn't have Cache's
    > flexibilities.
    >
    > Thank you,
    > Max
    >
    >
    >
     
    =?Utf-8?B?QnJhdWxpbyBEaWV6?=, Aug 17, 2007
    #3
  4. Hi Max,

    Yes, you Page.Cache is shared among all the sessions, actually Page.Cache
    is just HttpContext.Cache which is a global storage available within the
    entire ASP.NET application scope(AppDomain). And it is a good place to
    store some global data since it also provide some cachepolicy to make cache
    item expired(such as File based, Database based or timespan based ....)

    http://www.codeproject.com/aspnet/exploresessionandcache.asp

    Also, other means for share objects within application scope include:

    ** store object/data in database

    ** use a public class's static member variables to hold objects

    static member variable is useful for simple data caching scenario and you
    need to take care of the concurrent accessing and update of the data in
    shared static members.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Steven Cheng[MSFT], Aug 17, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ken Cox [Microsoft MVP]

    Re: Relationship between IIS Sessions and ASP.NET Sessions?

    Ken Cox [Microsoft MVP], Aug 8, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    5,369
    Luther Miller
    Aug 8, 2003
  2. DesignerX

    Page.Cache vs HttpContext.Current.Cache

    DesignerX, Jan 20, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    8,259
    vMike
    Jan 20, 2004
  3. John
    Replies:
    2
    Views:
    1,184
  4. scottymo
    Replies:
    3
    Views:
    706
    Dominick Baier
    Sep 30, 2006
  5. Bookham Measures

    Moving from ASP Sessions to Database Sessions

    Bookham Measures, Jul 23, 2007, in forum: ASP General
    Replies:
    19
    Views:
    569
    Bookham Measures
    Aug 23, 2007
Loading...

Share This Page