http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&frame=right&th=a1e21baa
ba5303d7&seekm=8b702e36.0403261601.32f47810%40posting.google.com#link2
> The poster of this thread got me thinking.
That's always a good thing. :-)
> He says that "Any time you
> can have multiple threads, especially multiple page requests,
[quoted text clipped - 13 lines]
> HttpRuntime.Cache.Insert("dsProducts", dsProducts)
> End If
The problem with the above isn't the redundant work in inserting a DataSet
into the Cache. The problem is that each of the threads doing the insert
could be operating on a different DataSet.
I believe that Application_Start will only execute once per application
instance. The only way I can see for you to get into trouble there would be
in some pathological case where the web application resets while your code
is still executing Application_Start. If that's guaranteed by Microsoft to
be impossible, then you should be ok.
The problem would come in if you had the above code on a page. In that case,
without any guarantees on how many threads can execute the code at the same
time, you could wind up two threads inserting and using different DataSets.

Signature
John Saunders
John.Saunders at SurfControl.com
Gary Bagen - 30 Mar 2004 00:14 GMT
Good point John. I will stipulate that the data going into the Cache
must be the same for all users. The Session would be for the user
specific data.
Gar
> http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&frame=right&th=a1e21baa
ba5303d7&seekm=8b702e36.0403261601.32f47810%40posting.google.com#link2
> >
[quoted text clipped - 33 lines]
> without any guarantees on how many threads can execute the code at the same
> time, you could wind up two threads inserting and using different DataSets.
coollzh - 01 Apr 2004 13:24 GMT
but if my Cache have been Invalidate, i must refresh my Cache.at this point,
mutil threads maybe refresh the Cache of Dataset?? i think we should make
some synchronization on modifying Cache.
"John Saunders" <john.saunders at SurfControl.com> ????????????
:#U2iOWcFEHA.2052@TK2MSFTNGP11.phx.gbl...
http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&frame=right&th=a1e2
1baaba5303d7&seekm=8b702e36.0403261601.32f47810%40posting.google.com#link2
> > The poster of this thread got me thinking.
>
[quoted text clipped - 34 lines]
> John Saunders
> John.Saunders at SurfControl.com
John Saunders - 01 Apr 2004 21:13 GMT
> but if my Cache have been Invalidate, i must refresh my Cache.at this point,
> mutil threads maybe refresh the Cache of Dataset?? i think we should make
> some synchronization on modifying Cache.
Good point. I forgot about invalidation.
If ASP.NET doesn't guarantee that the CacheItemRemovedCallback locks the
Cache, then you will need to lock it yourself.

Signature
John Saunders
John.Saunders at SurfControl.com
> "John Saunders" <john.saunders at SurfControl.com> ????????????
> :#U2iOWcFEHA.2052@TK2MSFTNGP11.phx.gbl...
http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&frame=right&th=a1e2
> 1baaba5303d7&seekm=8b702e36.0403261601.32f47810%40posting.google.com#link2
> > >
[quoted text clipped - 40 lines]
> > John Saunders
> > John.Saunders at SurfControl.com