471,354 Members | 1,190 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

Caching using HTTPContext

This is the scenario. The flow of control goes from

WebService --> OurManager --> Persistence --> Database

also OurManager spwans a thread to execute the EmailSubsystem. This
system ues the persistence to retrive some information from the
database as well.

Our persistence layer depends on the HTTPContext for caching.
So when I try to spawn a thread from OurManager subsystem to execute
the EmailSubsystem, which collects some information from the database
and sends out email, our Persistence fails.

I want to know if there is someway that we can cache our objects
irrespective of the HTTPContext thread of execution, so that the cache
can be accessed from any other subsystem.

I hope I conveyed my idea well. Your help would be appreciated. Thanks.

Jan 12 '06 #1
2 3887
The HttpContext is thread specific (understandably so, even). Because
of this, you need to pass the HttpContext along to your thread.

However, I would not recommend accessing the Response, and writing to
anything, and you might have to provide thread-safe access to the members,
as I don't believe that the context, or the cache, request, response, etc,
etc are thread-safe either.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<kp******@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
This is the scenario. The flow of control goes from

WebService --> OurManager --> Persistence --> Database

also OurManager spwans a thread to execute the EmailSubsystem. This
system ues the persistence to retrive some information from the
database as well.

Our persistence layer depends on the HTTPContext for caching.
So when I try to spawn a thread from OurManager subsystem to execute
the EmailSubsystem, which collects some information from the database
and sends out email, our Persistence fails.

I want to know if there is someway that we can cache our objects
irrespective of the HTTPContext thread of execution, so that the cache
can be accessed from any other subsystem.

I hope I conveyed my idea well. Your help would be appreciated. Thanks.

Jan 12 '06 #2
One thing you might try, assuming that your "other subsystems" are running in
the same AppDomain the HTTPContext is running in, is to use the AppDomain
Cache:

System.AppDomain.CurrentDomain.SetData
and
System.AppDomain.CurrentDomain.GetData

So when your HttpContext comes in you would store the data / objects
immediately in AppDoman Cache with a unique id.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"kp******@gmail.com" wrote:
This is the scenario. The flow of control goes from

WebService --> OurManager --> Persistence --> Database

also OurManager spwans a thread to execute the EmailSubsystem. This
system ues the persistence to retrive some information from the
database as well.

Our persistence layer depends on the HTTPContext for caching.
So when I try to spawn a thread from OurManager subsystem to execute
the EmailSubsystem, which collects some information from the database
and sends out email, our Persistence fails.

I want to know if there is someway that we can cache our objects
irrespective of the HTTPContext thread of execution, so that the cache
can be accessed from any other subsystem.

I hope I conveyed my idea well. Your help would be appreciated. Thanks.

Jan 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jo Versmissen | last post: by
2 posts views Thread by Tim | last post: by
2 posts views Thread by Steve W | last post: by
2 posts views Thread by R-D-C | last post: by
reply views Thread by Rick Hein | last post: by
2 posts views Thread by George1776 | last post: by
2 posts views Thread by aptenodytesforsteri | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.