473,795 Members | 2,452 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using cache application block in web application

has anyone managed to use cache application block in a web application?

thanks
stanley
Jul 21 '05 #1
6 4122
Yes.

What's wrong

- Joris

"Stanley" <St*****@discus sions.microsoft .com> wrote in message
news:2F******** *************** ***********@mic rosoft.com...
has anyone managed to use cache application block in a web application?

thanks
stanley

Jul 21 '05 #2
I have put the caching application block setting in the web.config file but
when i call CacheManager.Ge tCacheManager() , i got an exception
("Configurat ion information is not available"). Following is the CAB settings:

<configSections >
<section name="CacheMana gerSettings"
type="Microsoft .ApplicationBlo cks.Cache.Cache ConfigurationHa ndler,Microsoft .ApplicationBlo cks.Cache" />
<section name="CacheServ ice"
type="Microsoft .ApplicationBlo cks.Cache.Cache ConfigurationHa ndler,Microsoft .ApplicationBlo cks.Cache" />
</configSections>

<!-- CACHING BLOCK SETTINGS -->
<CacheManagerSe ttings>
<StorageInfo AssemblyName="M icrosoft.Applic ationBlocks.Cac he"
ClassName="Micr osoft.Applicati onBlocks.Cache. Storages.Single tonCacheStorage "
Mode="InProc" Validated="fals e" Encrypted="fals e" />
<ScavengingIn fo AssemblyName="M icrosoft.Applic ationBlocks.Cac he"
ClassName="Micr osoft.Applicati onBlocks.Cache. Scavenging.LruS cavenging"
UtilizationForS cavenging="80" MaximumSize="20 0" />
<ExpirationIn fo Interval="15" />
</CacheManagerSet tings>

<CacheService >
<StorageInfo>
<AssemblyName>M icrosoft.Applic ationBlocks.Cac he</AssemblyName>
<ClassName>Micr osoft.Applicati onBlocks.Cache. Storages.Single tonCacheStorage </ClassName>
<Mode>InProc</Mode>
<MaximumSize>20 0</MaximumSize>
</StorageInfo>
<Scavenging>
<Algorithm>
<AssemblyName>M icrosoft.Applic ationBlocks.Cac he</AssemblyName>
<ClassName>Micr osoft.Applicati onBlocks.Cache. Scavenging.LruS canvenging</ClassName>
</Algorithm>
<MemoryPollingP eriod>60</MemoryPollingPe riod>
<UtilizationFor Scavenging>80</UtilizationForS cavenging>
</Scavenging>
<ExpirationChec kInterval>2</ExpirationCheck Interval>
</CacheService>
"Joris Dobbelsteen" wrote:
Yes.

What's wrong

- Joris

"Stanley" <St*****@discus sions.microsoft .com> wrote in message
news:2F******** *************** ***********@mic rosoft.com...
has anyone managed to use cache application block in a web application?

thanks
stanley


Jul 21 '05 #3
Do you happen to use the "Commerce Server"? With that thing I don't have
any experience (sorry for that)...
I couldn't find anything in the MSDN directly and a search to "CacheManag er"
resulted in articles from the Commerce Server 2000/2002...
I did use ASP.NET Caching quite extensively and also added some code to
reduce the bandwidth even further (returning 304 quite frequently).

I believe you are really doing it the hard way. My code to support ASP.NET
caching is quite small

(on an object that derives from System.Web.UI.P age, C#)
Object obj = Cache["MyNeededObject "];
if (obj = null)
{
obj = ...
Cache.Add("MyNe ededObject", obj, DateTime.Now(). AddMinutes(5), null);
}
......

Eventually I moved the SQL stuff to a different class, where the constructor
of that class required you to pass the cache object with it.

You can also set the caching of a page (really recommended, as proxies on
the way do that too).
in Response.Cachin g object I believe.
Check out
http://hoogendroog.ath.cx/ - first time costs time, second load should be
very fast
http://hoogendroog.ath.cx/default.aspx/peekcache - shows the current ASP.NET
cache contents
(If the second one doesn't show any items, at least visit the home page)

For the first page, when looking at the HTTP protocol you can sometimes see
the 'Expires' header counting down, ASP.NET is caching in this case.
If not, my code is returning the 304 header (don't forget to include the
If-Modified-Since request header set to the received Last-Modified response
header).

- Joris
<snip>
Jul 21 '05 #4
Do you happen to use the "Commerce Server"? With that thing I don't have
any experience (sorry for that)...
I couldn't find anything in the MSDN directly and a search to "CacheManag er"
resulted in articles from the Commerce Server 2000/2002...
I did use ASP.NET Caching quite extensively and also added some code to
reduce the bandwidth even further (returning 304 quite frequently).

I believe you are really doing it the hard way. My code to support ASP.NET
caching is quite small

(on an object that derives from System.Web.UI.P age, C#)
Object obj = Cache["MyNeededObject "];
if (obj = null)
{
obj = ...
Cache.Add("MyNe ededObject", obj, DateTime.Now(). AddMinutes(5), null);
}
......

Eventually I moved the SQL stuff to a different class, where the constructor
of that class required you to pass the cache object with it.

You can also set the caching of a page (really recommended, as proxies on
the way do that too).
in Response.Cachin g object I believe.
Check out
http://hoogendroog.ath.cx/ - first time costs time, second load should be
very fast
http://hoogendroog.ath.cx/default.aspx/peekcache - shows the current ASP.NET
cache contents
(If the second one doesn't show any items, at least visit the home page)

For the first page, when looking at the HTTP protocol you can sometimes see
the 'Expires' header counting down, ASP.NET is caching in this case.
If not, my code is returning the 304 header (don't forget to include the
If-Modified-Since request header set to the received Last-Modified response
header).

- Joris
<snip>
Jul 21 '05 #5
hi Joris,

when i set the expiration and itemremovedcall back when i add the item to
cache. the callback only executed once. in this itemremovedcall back function,
i added the item back to cache again.

how come it would not execute the callback on the second time?
"Joris Dobbelsteen" wrote:
Do you happen to use the "Commerce Server"? With that thing I don't have
any experience (sorry for that)...
I couldn't find anything in the MSDN directly and a search to "CacheManag er"
resulted in articles from the Commerce Server 2000/2002...
I did use ASP.NET Caching quite extensively and also added some code to
reduce the bandwidth even further (returning 304 quite frequently).

I believe you are really doing it the hard way. My code to support ASP.NET
caching is quite small

(on an object that derives from System.Web.UI.P age, C#)
Object obj = Cache["MyNeededObject "];
if (obj = null)
{
obj = ...
Cache.Add("MyNe ededObject", obj, DateTime.Now(). AddMinutes(5), null);
}
......

Eventually I moved the SQL stuff to a different class, where the constructor
of that class required you to pass the cache object with it.

You can also set the caching of a page (really recommended, as proxies on
the way do that too).
in Response.Cachin g object I believe.
Check out
http://hoogendroog.ath.cx/ - first time costs time, second load should be
very fast
http://hoogendroog.ath.cx/default.aspx/peekcache - shows the current ASP.NET
cache contents
(If the second one doesn't show any items, at least visit the home page)

For the first page, when looking at the HTTP protocol you can sometimes see
the 'Expires' header counting down, ASP.NET is caching in this case.
If not, my code is returning the 304 header (don't forget to include the
If-Modified-Since request header set to the received Last-Modified response
header).

- Joris
<snip>

Jul 21 '05 #6
"Stanley" <St*****@discus sions.microsoft .com> wrote in message
news:F2******** *************** ***********@mic rosoft.com...
hi Joris,

when i set the expiration and itemremovedcall back when i add the item to
cache. the callback only executed once. in this itemremovedcall back function, i added the item back to cache again.
Your should NOT do that. Really, you should only cache data when you NEED
them.

The cache will expire objects not only when they expire, but also to
preserve the systems resources sometimes. It provides some priority mechnism
to deside what to remove when resources run out.

My software uses a class to load a dataset on-demand.
If its in cache, get it from cache, otherwise I execute the database query
and put the data in the cache.

Use the cache just like a web proxy does.
When you make the request it is either fetched from cache or from the
internet (and cached). When the web proxy runs out of space, it will clean
expired items. The ASP.NET cache works the same way.
how come it would not execute the callback on the second time?


When using the Add method, it will fail if a similair named item is in the
cache.
Use Insert to overwrite.
Ensure you specify the callback.

<snip>

Another interest might be using the Response.Cachin g object to ensure the
page is cached all over the internet (and with ASP.NET page caching too). It
has good facilities to prevent processing the page again, when its not
needed. (You can save processing power and network bandwidth when doing it
correctly).

- Joris
Jul 21 '05 #7

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

Similar topics

5
14233
by: Alex | last post by:
Hi all, We're looking at a vendor who uses the InterSystems Cache Database Platform, but our IT department has zero experience with this system. This software package will have a pivotal and mission critical roll in our organization, so I'd like some comments on what others think of this database platform. Mainly I'm curious how easy/difficult it is to query a Cache Database, and does it use standard SQL calls like Oracle and MS SQL? ...
0
1406
by: Matthew | last post by:
Hi all, I am attempting to cache a loaded XslTransform object using the cache application block. I get "System.Xsl.XslTransform.....is not marked as serializable" I guess the cache appl block uses serialization internally, but I am a little surprised that its impossible to cache these objects. Seems like the XmlDocument class would be the same. I see a few posts related to custom serialization and surrogates? is that the solution?
0
1053
by: Aamir79 | last post by:
Hi all, I'm using Microsoft Applications cache block in my web application. It worked fine for sometime then suddenly it is raising the following error: Message: "Can't validate the current data item. Maybe it was altered." Source: "Microsoft.ApplicationBlocks.Cache" StackTrace: "at Microsoft.ApplicationBlocks.Cache.DataProtectionManager.RemoveMAC(Byte binaryMacValue) in
2
3106
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...
26
6282
by: Ed L. | last post by:
Here's some of my current notions on pgsql performance tuning strictly as it relates to pgsql tuning parameters in the context of a dedicated linux or hpux server. I'm particularly focusing on the shared_buffers setting. I invite any corrective or confirming feedback. I realize there are many other hugely important performance factors outside this scope. One key aspect of pgsql performance tuning is to adjust the memory ...
5
357
by: Stanley | last post by:
has anyone managed to use cache application block in a web application? thanks stanley
2
2570
by: g_srileka | last post by:
Shall i use Cache class and its methods for creating c# dll file. i tried to access insert and get methods of Cache ,but i couldn't get it ,even i imported System.Web.Caching . i am getting An object reference is required for the nonstatic field, method, or property 'System.Web.Caching.Cache.Get(string)' error while debugging if anyone knows.plz give me the answer
1
10363
by: Macca | last post by:
Hi I have a N-tier ASP.NET application that uses a data access tier to get data from a database and pass it to the middleware/business tier for processing/filtering and then passes the modified data to the web tier for presentaion. What I would like to do is introduce a cache to the middleware tier to cut down on the round trips to the database.
0
1187
by: =?Utf-8?B?d2lsbGlhbQ==?= | last post by:
Hi, I want to cache some stable user information on client side for later use by VB clients, so I implement enterprise library cache application block in COM+ serviced component which is developed in C#. I can save and retrieve it in short time period. The issue is the data will be expired in a few minutes even if I set the expiration to datatime.maxvalue. Here is code: cacheManager.Add(key, val, CacheItemPriority.Normal, null, new...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
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
10437
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
10001
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
9042
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...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
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 we have to send another system
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
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.