473,322 Members | 1,538 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,322 software developers and data experts.

System.Web.Caching.Cache

Hi

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

Does this mean that if I access System.Web.Caching.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 3128
"Peter" <xd****@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Hi

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

Does this mean that if I access System.Web.Caching.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****************@TK2MSFTNGP05.phx.gbl...
Hi

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

Does this mean that if I access System.Web.Caching.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
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....
3
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...
2
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...
5
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),...
3
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...
2
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 :...
5
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...
4
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...
2
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.