Are Application collection and Page.Cache thread safe?

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

  1. Max2006

    Max2006 Guest

    Hi,

    Since Application collection and Page.Cache can be shared among all
    sessions, I wonder if they are thread safe?

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

  2. Max2006

    Scott M. Guest

    Max,

    Thread safety is disclosed in the MSDN help topic for a given class.

    -Scott


    "Max2006" <> wrote in message
    news:u01WM$...
    > Hi,
    >
    > Since Application collection and Page.Cache can be shared among all
    > sessions, I wonder if they are thread safe?
    >
    > Thank you,
    > Max
    >
    >
    >
     
    Scott M., Aug 17, 2007
    #2
    1. Advertising

  3. Max2006

    bruce barker Guest

    the collections are thread safe, but the objects you add to the
    collection may or may not be.

    -- bruce (sqlwork.com)

    Max2006 wrote:
    > Hi,
    >
    > Since Application collection and Page.Cache can be shared among all
    > sessions, I wonder if they are thread safe?
    >
    > Thank you,
    > Max
    >
    >
    >
     
    bruce barker, Aug 17, 2007
    #3
  4. Cache is thread safe.
    Application is also thread safe as long as you remember to use its Lock and
    Unlock methods.

    --
    I hope this helps,
    Steve C. Orr,
    MCSD, MVP, CSM, ASPInsider
    http://SteveOrr.net


    "Max2006" <> wrote in message
    news:u01WM$...
    > Hi,
    >
    > Since Application collection and Page.Cache can be shared among all
    > sessions, I wonder if they are thread safe?
    >
    > Thank you,
    > Max
    >
    >
    >
     
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider], Aug 18, 2007
    #4
  5. Hi Max,

    Application State is provided in ASP.NET for compatible with classic ASP
    application and you need to perform lock/unlock over it to make sure
    thread-safe. Application Cache in ASP.NET is built-in thread safe, that
    means you can freely store and access objects in Cache entry without
    additional lock/unlock(or other synchronize operations). However, I agree
    with Bruce that you need to take care of the objects you want to store in
    Cache, whether the objects (you'll store in Cache, or to share them) is
    thread-safe is important if you'll take care of the concurrent accessing in
    your web application.

    BTW, I also saw your another thread "Can we use static table adapters in
    highly concurrent web sites?" in the newsgroup, and some other members have
    also replied you there. Please feel free to have a look also.

    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 20, 2007
    #5
  6. Hi Max,

    Does the info in previous messages help you? If you have any other
    questions ,please feel free to post here.

    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 22, 2007
    #6
    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. =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=

    Thread safe singleton to access the cache?

    =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=, Oct 6, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    803
    Bruce Barker
    Oct 6, 2005
  2. Timo
    Replies:
    0
    Views:
    380
  3. Øyvind Isaksen
    Replies:
    1
    Views:
    1,002
    Øyvind Isaksen
    May 18, 2007
  4. Gabriel Rossetti
    Replies:
    0
    Views:
    1,366
    Gabriel Rossetti
    Aug 29, 2008
  5. John Nagle
    Replies:
    5
    Views:
    487
    John Nagle
    Mar 12, 2012
Loading...

Share This Page