473,806 Members | 2,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3994
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.co m

<kp******@gmail .com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.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.AppDomai n.CurrentDomain .SetData
and
System.AppDomai n.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
3111
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. .... Cache cache = HttpContext.Current.Cache; Table table; // Get the table from the cache table = (Table) cache.Get("myCacheKey");
2
1662
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 other developers can use it too. I'm instaintiating the Cache class like this but the methods do not work like this. Cache webCache = new Cache(); webCache.Add(.......)
2
3108
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 application (in this case a VB.NET windows service). I'd like to create something like the cache in this service to hold application-wide information (like database connection strings) and then pass that into the components. As a test, I tried...
2
2470
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 in the querystring). I have tried switching on output caching and varying by a parameter and using VaryByCustom but the caching simply does not work. Tested it by adding the time to the bottom of the page and the time updates every time we...
0
1759
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 code works correctly. If there is no debugger it doesn't fire, which causes the app to have problems. Here's what the code does: The TemplateData class inherits from the DataSet Object, in the constructor it loads itself with Data from an XML...
0
1152
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 what's causing it. The website is www.homester.co.uk/homebuyers/search.aspx. I have asked another asp.net developer and he thought it was to do with page caching but i've since removed the page caching tag from the html page and the error is still...
2
6145
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 simply be a result of being out of memory.) We're running on IIS 5.1 on a single Windows 2000 server. We have a separate database server - SQL Server 2000 64 bit. Session state is stored on the database.
2
2190
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 output caching would be useful. I implemented output caching at 60 seconds.
4
15136
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 (List<AssetSummary>)System.Web.Caching.Cache("assetSummary"); }
0
9597
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
10618
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...
0
10366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10371
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
10110
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
9187
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
7649
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
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.