473,426 Members | 1,433 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,426 software developers and data experts.

Are Application collection and Page.Cache thread safe?

Hi,

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

Thank you,
Max

Aug 17 '07 #1
5 4812
Max,

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

-Scott
"Max2006" <al*******@newsgroup.nospamwrote in message
news:u0**************@TK2MSFTNGP05.phx.gbl...
Hi,

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

Thank you,
Max

Aug 17 '07 #2
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
Aug 17 '07 #3
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" <al*******@newsgroup.nospamwrote in message
news:u0**************@TK2MSFTNGP05.phx.gbl...
Hi,

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

Thank you,
Max
Aug 18 '07 #4
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.
Aug 20 '07 #5
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.
Aug 22 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Grandma Wilkerson | last post by:
Hi, The documentation states that enumeration through a collection is inherently NOT thread-safe, since a thread which added/removed an item from said collection could screw up the thread that...
11
by: Daniel Billingsley | last post by:
Let's say I'm writing a business app and I want there to be only one instance of the Customer object for each particular customer (representing a database record) being edited. Would it be...
4
by: Keith Chadwick | last post by:
I am having some trouble referencing an Application("myVar") variable from within a module.vb file on my ASP.NET site. According to the documentation I should be able to reference...
4
by: Frank Rizzo | last post by:
In classic ASP, it was considered a bad idea to store VB6-created objects in the Application variable for various threading issues. What's the current wisdom on storing objects in the Application...
2
by: stefano mostarda | last post by:
Hi there, In my application I need a dataset containing tables often used in pages. They must be always available so I though Application would likely be the best place to store the dataset. But...
6
by: Tony Fonager | last post by:
I am currently developing a statistics system in ASP.NET, and need to share information about the customers websites, in this application. (I have simplified my code, to make my project easier to...
7
by: Greg Collins [MVP] | last post by:
Hi, I couldn't find what I was looking for by searching the newsgroup, but perhaps these have already been discussed somewhere. This is a bit long with a lot of interrelated questions. What I've...
2
by: lwhitb1 | last post by:
Does anyone have any input on setting up my CAB application so that the application is thread safe, and cached appropiately? I read that this can be managed through Services, and dynamic injection....
4
by: Dave | last post by:
I have a global.asax file with Application_Start defined and create some static data there and in another module used in the asp.net application and I realize that static data is shared amongst...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.