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

About Cache

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

"eXseraph" <eX******@discussions.microsoft.com> wrote in message
news:59**********************************@microsof t.com...
In application state, we need to use "Application.Lock()" before we write
something into Application["xxx"]. My question is do we need use
"Application.Lock()" 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******@discussions.microsoft.com> wrote in message
news:59**********************************@microsof t.com...
In application state, we need to use "Application.Lock()" before we write
something into Application["xxx"]. My question is do we need use
"Application.Lock()" 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******@discussions.microsoft.com> wrote in message
news:59**********************************@microsof t.com...
In application state, we need to use "Application.Lock()" before we write
something into Application["xxx"]. My question is do we need use
"Application.Lock()" to LOCK the cache before we write into Cache["xxx"]?

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

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

"Shiva" wrote:
No, not required.

"eXseraph" <eX******@discussions.microsoft.com> wrote in message
news:59**********************************@microsof t.com...
In application state, we need to use "Application.Lock()" before we write
something into Application["xxx"]. My question is do we need use
"Application.Lock()" 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******@discussions.microsoft.com> wrote in message
news:59**********************************@microsof t.com...
| In application state, we need to use "Application.Lock()" before we write
| something into Application["xxx"]. My question is do we need use
| "Application.Lock()" 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
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...
1
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...
10
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
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...
9
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...
4
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...
1
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...
4
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. ...
2
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"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
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: 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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
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

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.