473,473 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ASP.Net, caches, scope of statics

Hi...

At least by the group title, this seems like a question for
dotnet.framework.aspnet.caching but that group seems pretty slow.

I'm trying to sort things out with a co-worker. We've got some classes that
implement some in-memory caches with static Hashtable members. My
understanding is that a static Hashtable may be shared between threads in
the worker process but that it won't span multiple worker processes.

I'm not sure about the System.Web.Caching.Cache class. You can't
instantiate one of your own, so I'm not sure if there's something buried down
in the framework to make this work across processes in a garden.

Also not sure if you can achieve better sharing by putting a C# class in the
Application scope (sorry if that's nonsensical; I haven't actually put
objects in application scope since classic asp).

Thanks
Mark

Jun 27 '08 #1
3 1365
Hi Mark,

Regarding on the ASP.NET Cache question you mentioned, here are some of my
understanding:

** ASP.NET Cache is per AppDomain based. Since each ASP.NET application is
scoped at AppDomain level(just like normal .net application), different
ASP.NET application instances(such as webfarm instances) can not share
Cache data.

** Sure, you can use some custom Class and Static member properties to
cache data instead of built-in Cache, the scope is the same(within the same
appdomain). However, the advantage of ASP.NET Cache is that it provide
multiple Cache Dependencies that can help you add auto-expire/invalidate
support. For example, you can use time based or data based cache dependency
so as to make a cache item be invalidated after a certain timespan (or a
certain database table is changed).

** If you have requirement to share data among webfarm server instances. I
think using database is still the preferred approach.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?TWFyaw==?= <mm******@nospam.nospam>
Subject: ASP.Net, caches, scope of statics
Date: Wed, 16 Apr 2008 14:58:01 -0700
>Hi...

At least by the group title, this seems like a question for
dotnet.framework.aspnet.caching but that group seems pretty slow.

I'm trying to sort things out with a co-worker. We've got some classes
that
>implement some in-memory caches with static Hashtable members. My
understanding is that a static Hashtable may be shared between threads in
the worker process but that it won't span multiple worker processes.

I'm not sure about the System.Web.Caching.Cache class. You can't
instantiate one of your own, so I'm not sure if there's something buried
down
>in the framework to make this work across processes in a garden.

Also not sure if you can achieve better sharing by putting a C# class in
the
>Application scope (sorry if that's nonsensical; I haven't actually put
objects in application scope since classic asp).

Thanks
Mark

Jun 27 '08 #2
If you'd like to share data among different processes(in this
situation, web farm contains a lot of different processes), it's
better redesign your application structure.
You can use a remoting server here as a centralized caching service
serving different web applications.

On Apr 17, 5:58*am, Mark <mmodr...@nospam.nospamwrote:
Hi...

At least by the group title, this seems like a question for
dotnet.framework.aspnet.caching but that group seems pretty slow.

I'm trying to sort things out with a co-worker. *We've got some classes that
implement some in-memory caches with static Hashtable members. *My
understanding is that a static Hashtable may be shared between threads *in
the worker process but that it won't span multiple worker processes.

I'm not sure about the System.Web.Caching.Cache class. *You can't
instantiate one of your own, so I'm not sure if there's something buried down
in the framework to make this work across processes in a garden.

Also not sure if you can achieve better sharing by putting a C# class in the
Application scope (sorry if that's nonsensical; I haven't actually put
objects in application scope since classic asp).

Thanks
Mark
Jun 27 '08 #3
Hi Mark,

How are you doing, do you have any further questions on this?

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: st*****@online.microsoft.com (Steven Cheng [MSFT])
Organization: Microsoft
Date: Thu, 17 Apr 2008 03:54:13 GMT
Subject: RE: ASP.Net, caches, scope of statics
>
Hi Mark,

Regarding on the ASP.NET Cache question you mentioned, here are some of my
understanding:

** ASP.NET Cache is per AppDomain based. Since each ASP.NET application is
scoped at AppDomain level(just like normal .net application), different
ASP.NET application instances(such as webfarm instances) can not share
Cache data.

** Sure, you can use some custom Class and Static member properties to
cache data instead of built-in Cache, the scope is the same(within the
same
>appdomain). However, the advantage of ASP.NET Cache is that it provide
multiple Cache Dependencies that can help you add auto-expire/invalidate
support. For example, you can use time based or data based cache
dependency
>so as to make a cache item be invalidated after a certain timespan (or a
certain database table is changed).

** If you have requirement to share data among webfarm server instances. I
think using database is still the preferred approach.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================= =
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ault.aspx#noti
f
>ications.

================================================= =
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>>From: =?Utf-8?B?TWFyaw==?= <mm******@nospam.nospam>
Subject: ASP.Net, caches, scope of statics
Date: Wed, 16 Apr 2008 14:58:01 -0700
>>Hi...

At least by the group title, this seems like a question for
dotnet.framework.aspnet.caching but that group seems pretty slow.

I'm trying to sort things out with a co-worker. We've got some classes
that
>>implement some in-memory caches with static Hashtable members. My
understanding is that a static Hashtable may be shared between threads
in
>>the worker process but that it won't span multiple worker processes.

I'm not sure about the System.Web.Caching.Cache class. You can't
instantiate one of your own, so I'm not sure if there's something buried
down
>>in the framework to make this work across processes in a garden.

Also not sure if you can achieve better sharing by putting a C# class in
the
>>Application scope (sorry if that's nonsensical; I haven't actually put
objects in application scope since classic asp).

Thanks
Mark


Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Phil Powell | last post by:
I created a page that will be doing image resizing and manipulation, which seems to work (using GD library). However, upon returning to the page where the image has been changed, I still see the...
5
by: Stuart MacMartin | last post by:
I have a problem with static lifetime (order of destruction of statics within different cpp files). I have a workaround that happens to work in my case. I'd like to know if this is luck or...
38
by: Lasse Vågsæther Karlsen | last post by:
After working through a fair number of the challenges at www.mathschallenge.net, I noticed that some long-running functions can be helped *a lot* by caching their function results and retrieving...
4
by: Gery D. Dorazio | last post by:
Gurus, If a static variable is defined in a class what is the scope of the variable resolved to for it to remain 'static'? For instance, lets say I create a class library assembly that is...
20
by: Aek | last post by:
We recently moved our large codebase over from VS7 to 8 and found that we now get access violations in atexit calls at shutdown when debugging the application in VS2005. This occurs in static...
4
by: Luna Moon | last post by:
seeking highly efficient caches scheme for demanding engineering computing? HI all, To same the time of costly function evaluation, I want to explore the possibility of caching. Suppose in...
3
by: DR | last post by:
I heard there is some trick to referencing statics in C# CLR stored procedure without having to mark the assembly as unsafe. Does anyone know this? This is usefull as the case of needing a little...
6
by: tshad | last post by:
I have a class trying to access some public static variables in another class and one I can't seem to see. In the class where they are defined, the look like: public static object statusOutput...
0
by: jason-sage | last post by:
Hi all, I just started using the warnings module in Python 2.5.2. When I trigger a warning using the default warning options, an entry is created in a module-level cache so that the warning is...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
1
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...
0
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...
0
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.