472,780 Members | 1,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,780 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 3943
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jo Versmissen | last post by:
Does anyone know how a component can be cached server side. I know how to cache a component and it works, but I think this is client side caching, because it works with the current HttpContext. ...
2
by: Tim | last post by:
I'm building a .NET C# web application using web caching. The Cache class only works when I'm using an aspx page. I want this Caching logic to be in its own class file (.cs) in another project so...
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...
2
by: R-D-C | last post by:
Can these two functions coexist? We have a web site where the querystrings are removed using URL Rewriting. Instead the page appears to be a html page with a long name (containing what would be...
0
by: Rick Hein | last post by:
I've got a problem with an app I've been working on, the Caching object and events not firing correctly. In a nutshell: When I'm debugging, and I set a breakpoint in the removed item call back, the...
0
by: InnoCreate | last post by:
Hi Everyone, I'm a newbie to the group. Hope to be able to contribute something :D I have an asp.net v1.1 web application that randomly throws the error below. Does anyone have any idea's...
2
by: George1776 | last post by:
All, I've recently upgraded our production ASP.NET/C# application from framework 1.1 to 2.0. Since then I've been plagued by out-of-memory errors and problems with the cache object (which may...
2
by: aptenodytesforsteri | last post by:
I have an ASP.NET 2.0 application I've localized to English, French, German, and Italian. I used resource (.resx) files. Most of the site is static content, easily 90% of it, so I thought...
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...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?

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.