473,698 Members | 2,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.Web.Cach ing.Cache

Hi

The documentation for System.Web.Cach ing.Cache states that it is
"thread safe".

Does this mean that if I access System.Web.Cach ing.Cache from several
places in my application access to the items in the cache is
synchronised so I don't get problems with setting/getting the same item
at the same time?


Thanks,
Peter
Sep 4 '08 #1
2 3152
"Peter" <xd****@hotmail .comwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Hi

The documentation for System.Web.Cach ing.Cache states that it is
"thread safe".

Does this mean that if I access System.Web.Cach ing.Cache from several
places in my application access to the items in the cache is
synchronised so I don't get problems with setting/getting the same item
at the same time?
Thats correct. Bear in mind though that any mutable reference types
included in the cache may not be be threadsafe themselves. Also the cache
is not really designed to support the idea of modifying an existing value.
Its designed to allow content to be added, read and dropped in a threadsafe
manner.

--
Anthony Jones - MVP ASP/ASP.NET

Sep 4 '08 #2
Anthony Jones wrote:
"Peter" <xd****@hotmail .comwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Hi

The documentation for System.Web.Cach ing.Cache states that it is
"thread safe".

Does this mean that if I access System.Web.Cach ing.Cache from
several places in my application access to the items in the cache is
synchronised so I don't get problems with setting/getting the same
item at the same time?

Thats correct. Bear in mind though that any mutable reference types
included in the cache may not be be threadsafe themselves. Also the
cache is not really designed to support the idea of modifying an
existing value. Its designed to allow content to be added, read and
dropped in a threadsafe manner.
Thanks. I have one item I want to add to the cache, get from the cache,
and sometimes remove from the cache.

The item I want to add is a Dictionary containing various values.

I have one place which instantiates the dictionary, populates it, and
puts it in the cache.

I have several places which get the dictionary from the cache, use the
values in it (put not change the contents of it).

I have one place which will remove the dictionary from the cache. After
the Dictionary is removed, it will be re-instantiated, populated, and
put back in the cache.

Does that sound like it will give problems? What would happen if at one
place I get the dictionary from the cache, start performing tasks using
its contents, and then remove the dictionary from the cache while it is
still being used?
/Peter
Sep 4 '08 #3

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

Similar topics

9
2146
by: Just D. | last post by:
All, Did anybody see this strange effect? The web application is written in C#, ASP.NET, SQL, T-SQL, etc. A pretty usual stuff, complicated enough, but works fine until... Here is a question. I don't see any problem if I start this app on my local computer against my local IE both in debug or release modes. If I upload the same app to my corporate server where it works under HTTPS here are a few possible ways.
3
1638
by: Janaka | last post by:
Hi All, I'm having a problem with Page Output caching on a page that contains a DataGrid. Basically the page pulls up some data for sales information from the DB. Some of this has to be calculated on the fly when the request is made, and so I thought it would be ideal to cache the page for a set amount of time. I've placed the following at the top of my page: <%@ OutputCache Duration="160" VaryByParam="None" %> Now the problem is...
2
3100
by: Steve W | last post by:
I have an ASP.NET app that calls into some VB.NET components. It passes in the current application's cache (HttpContext.Current.Cache). These VB.NET components also get called by a non-ASP.NET application (in this case a VB.NET windows service). I'd like to create something like the cache in this service to hold application-wide information (like database connection strings) and then pass that into the components. As a test, I tried...
5
7851
by: Raj | last post by:
What is the purpose of file system caching while creating a tablespace? Memory on the test server gets used up pretty quickly after a user executes a complex query(database is already activated), after some investgation i found out that most of it being consumed by filesystem caching... thanks to Liam and Phil Sherman for their valuable suggestions. Is it safe to turn off filesystem caching on every tablespaceon the server(i.e. DIO) ??...
3
2943
by: Purti Malhotra | last post by:
Hi All, In our Web hosting environment we are using Virtual hosting i.e. multiple websites are on one server and multiple domains are pointing to a single website. Issue: We have two domains say “www.Test1.com” and “www.Test2.com” pointing to a single website. Website content is located onto UNCPath i.e. remote location. Domain 1: www.Test1.com points to \\servername\websitefolder\homedirectory
2
1872
by: Jurjen de Groot | last post by:
Hello, I'm developping an app in ASP.NET 2.0 using VS.NET 2005, I'm using System.Web.Caching.Cache to store various data between page calls (I've tried : httpContext.Current.Cache/httpRuntime.Cache). When executing the app using the webserver built in to VS.NET 2005 it works just fine, but when using IIS 6 it doesn't. I'm working on a P4 2.5Ghz, Windows XP Pro, IIS 6
5
4478
by: sethwai | last post by:
Hi, I've read everything I can get my hands on and am still very confused about the similarities and differences between db2_mmap_read/write and concurrent i/o. It seems to me at this point that they are virtually identical except that db2_mmap_read/write applies at an instance level and concurrent i/o can be aplied at a tablespace level. It seems that they both bypass the AIX file cache and eliminate i-node locking. Is this correct?
4
15128
by: Harry Haller | last post by:
What's wrong with this: Error 3 'System.Web.Caching.Cache' is a 'type', which is not valid in the given context public List<AssetSummaryGetAssetSummary() { return (List<AssetSummary>)System.Web.Caching.Cache("assetSummary"); }
2
1833
by: Ken Fine | last post by:
I have a question about ASP.NET output caching. I want to use screen scraping as a temporary hack to pull in some complex Classic ASP-rendered content into some ASP.NET pages: protected String ReadHtmlPage(string url) { WebResponse objResponse; WebRequest objRequest = System.Net.HttpWebRequest.Create(url); objResponse = objRequest.GetResponse();
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8611
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8904
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6531
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5867
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.