473,809 Members | 2,733 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

About Cache

In application state, we need to use "Application.Lo ck()" before we write
something into Application["xxx"]. My question is do we need use
"Application.Lo ck()" to LOCK the cache before we write into Cache["xxx"]?
Nov 18 '05 #1
5 1653
No, not required.

"eXseraph" <eX******@discu ssions.microsof t.com> wrote in message
news:59******** *************** ***********@mic rosoft.com...
In application state, we need to use "Application.Lo ck()" before we write
something into Application["xxx"]. My question is do we need use
"Application.Lo ck()" to LOCK the cache before we write into Cache["xxx"]?
Nov 18 '05 #2
someone can tell me why? How can asp.net keep synchronization without
Locking the cache?

"Shiva" wrote:
No, not required.

"eXseraph" <eX******@discu ssions.microsof t.com> wrote in message
news:59******** *************** ***********@mic rosoft.com...
In application state, we need to use "Application.Lo ck()" before we write
something into Application["xxx"]. My question is do we need use
"Application.Lo ck()" to LOCK the cache before we write into Cache["xxx"]?

Nov 18 '05 #3
Its not required. Its thread-safe.

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"eXseraph" <eX******@discu ssions.microsof t.com> wrote in message
news:59******** *************** ***********@mic rosoft.com...
In application state, we need to use "Application.Lo ck()" before we write
something into Application["xxx"]. My question is do we need use
"Application.Lo ck()" to LOCK the cache before we write into Cache["xxx"]?

Nov 18 '05 #4
Cache is thread-safe.

"eXseraph" <eX******@discu ssions.microsof t.com> wrote in message
news:68******** *************** ***********@mic rosoft.com...
someone can tell me why? How can asp.net keep synchronization without
Locking the cache?

"Shiva" wrote:
No, not required.

"eXseraph" <eX******@discu ssions.microsof t.com> wrote in message
news:59******** *************** ***********@mic rosoft.com...
In application state, we need to use "Application.Lo ck()" before we write
something into Application["xxx"]. My question is do we need use
"Application.Lo ck()" to LOCK the cache before we write into Cache["xxx"]?

Nov 18 '05 #5
you don't strickly need it for application either, as the actually update is
thread safe. but if you use the following logic:

test if not in cache/application
build object
stick in chahe/application
else
return cache/object.

with out a lock before the test, two (or more) threads can detect the empty
state, both build the object, and both place their created objectes in the
cache (last one winning). a lock before the test will prevent the race.
-- bruce (sqlwork.com)

"eXseraph" <eX******@discu ssions.microsof t.com> wrote in message
news:59******** *************** ***********@mic rosoft.com...
| In application state, we need to use "Application.Lo ck()" before we write
| something into Application["xxx"]. My question is do we need use
| "Application.Lo ck()" to LOCK the cache before we write into Cache["xxx"]?
Nov 18 '05 #6

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

Similar topics

220
19203
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it seems that Ruby has the potential to compete with and displace Python. I'm curious on what basis it...
1
1425
by: Tony Johansson | last post by:
Hello! I'm reading a book about C++ and there is something that I don't understand so I ask you. I have marked the section from the book that is of intertest by tagging it with BOOK START HERE and ending with BOOK ENDING HERE. All that text between is just a copy from the book. My question come after the text section. The book says
10
4135
by: Kieran Simkin | last post by:
Hi, I wonder if anyone can help me, I've been headscratching for a few hours over this. Basically, I've defined a struct called cache_object: struct cache_object { char hostname; char ipaddr; };
1
3374
by: Jim | last post by:
Hi, I have a few questions regarding the cache object: Does the cache object exist through postbacks? The cache object only exists for the current request, right? Is there a way to cache objects across multiple requests/sessions? Say, I have two users requesting the same page, can they share cached
9
1309
by: Joe Fallon | last post by:
If I add an instance of an object to the Cache what is returned when I request the item from the cache? Is it a clone of the object or is it a reference to the object? I want to know because I would like to go through the instantiaition process of a New instance only once and then store the object in the cache. I need to know if subsequent users of the object will be "stepping on each other" or not. So, do I have to speciifcally clone...
4
1204
by: Alan Silver | last post by:
Hello, I tried out using the cache the other day and was impressed with the concept. I built myself a custom control to generate the site links, using an XML file for the info. I kept the XML file in the cache and added a dependency so it will notice when the file changes. All fine so far. I was reading last night about using the OutputCache page directive to store the page in the cache. It seems you can do this for a user control
1
1395
by: Ray | last post by:
Dear all, Now, I am using Global Assembly Cache to share assembly between server and clients. However, it seems that the server and clients use individual Global Assembly Cache. For example, the assembly is placed in U drive, I have to use the Global Assembly Cache Tool in the client PC to add the assembly to the Global Assembly Cache of the client PC manually. Should I set something in the Global Assembly Cache Tool in the client PC in...
4
1281
by: mpaine | last post by:
I just converted lots of ASP to ASP.NET (using ASP2ASPX) and noticed a drop in rendering speed. For example, one ASP page takes 0.0313s to be generated while the ASP.NET version takes 0.4842s. Granted they are both fast but the ASP speeds makes me think ASP object caching is better/faster (as the SQL is the exactly the same) Either that or I don't have something setup correctly (yet). ASP pages use: Response.Expires = -1
2
1728
by: matthias s | last post by:
Hi There, I'm currently building a webservice using a class library which encapsulates all business logic and a cache mechanism as well to hold recently used objects. Lets call this "core.dll". I'm accessing the cache using HttpContext.Current.Cache within this assembly. My question is, if I now start build a standard asp.net application using the same core.dll, will objects placed in the cache duplicate? Say, core.dll has a NewsItem...
0
9601
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
10637
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
10379
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,...
0
10115
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9199
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7660
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
5550
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.