473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Caching data in a web app

Avoiding a connection problem due to network issues is our highest priority
for one of our apps. Hence, we'd like to cache 200 records so they are
available IF a connection wasn't available. However, it's my understanding
that you can cache an object (perhaps a DataSet) for a specified amount of
time. Let's say we cache it for 5 minutes. However, consider the scenario
where a new user comes in 6 minutes after the last cache, so wouldn't the
cached object be garbage collected? What if the connection fails at that
moment? I have NO data ... which is exactly what we're trying to avoid.
How do you recommend we deal with this issue? We could cache the thing all
day, but the data will change with some frequency so we'd like to have
updates as frequently as possible too.

Thanks in advance.

Mark
Nov 18 '05 #1
3 1413
Hi Mark,

You have a couple of choices. You can cache the data with no expiration, so
that it never is released. You can have it expire, and include logic that
rebuilds it when it is not there.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message
news:#6**************@TK2MSFTNGP09.phx.gbl...
Avoiding a connection problem due to network issues is our highest priority for one of our apps. Hence, we'd like to cache 200 records so they are
available IF a connection wasn't available. However, it's my understanding that you can cache an object (perhaps a DataSet) for a specified amount of
time. Let's say we cache it for 5 minutes. However, consider the scenario where a new user comes in 6 minutes after the last cache, so wouldn't the
cached object be garbage collected? What if the connection fails at that
moment? I have NO data ... which is exactly what we're trying to avoid.
How do you recommend we deal with this issue? We could cache the thing all day, but the data will change with some frequency so we'd like to have
updates as frequently as possible too.

Thanks in advance.

Mark

Nov 18 '05 #2
Hi Mark:

If it the results have to be there absolutely, positively all the
time, you might consider caching the DataSet on the web server by
saving it as an XML file on the file system.

Holding the DataSet in cache means it could be pushed out, as you
point out. You could keep it in the Application object, but this
collection would be cleared if the web application restarts for some
reason.

--
Scott
http://www.OdeToCode.com

On Mon, 30 Aug 2004 09:42:08 -0500, "Mark"
<mf****@idonotlikespam.cce.umn.edu> wrote:
Avoiding a connection problem due to network issues is our highest priority
for one of our apps. Hence, we'd like to cache 200 records so they are
available IF a connection wasn't available. However, it's my understanding
that you can cache an object (perhaps a DataSet) for a specified amount of
time. Let's say we cache it for 5 minutes. However, consider the scenario
where a new user comes in 6 minutes after the last cache, so wouldn't the
cached object be garbage collected? What if the connection fails at that
moment? I have NO data ... which is exactly what we're trying to avoid.
How do you recommend we deal with this issue? We could cache the thing all
day, but the data will change with some frequency so we'd like to have
updates as frequently as possible too.

Thanks in advance.

Mark


Nov 18 '05 #3
i agree with kevin, set it to not expire and everytime it there is a change
remove the object from cache that way next request will fetch it from db and
then set the cache before returning the data.

that way you will have minimum connections to db.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:uF**************@tk2msftngp13.phx.gbl...
Hi Mark,

You have a couple of choices. You can cache the data with no expiration, so that it never is released. You can have it expire, and include logic that
rebuilds it when it is not there.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message
news:#6**************@TK2MSFTNGP09.phx.gbl...
Avoiding a connection problem due to network issues is our highest

priority
for one of our apps. Hence, we'd like to cache 200 records so they are
available IF a connection wasn't available. However, it's my

understanding
that you can cache an object (perhaps a DataSet) for a specified amount of time. Let's say we cache it for 5 minutes. However, consider the

scenario
where a new user comes in 6 minutes after the last cache, so wouldn't the cached object be garbage collected? What if the connection fails at that moment? I have NO data ... which is exactly what we're trying to avoid.
How do you recommend we deal with this issue? We could cache the thing

all
day, but the data will change with some frequency so we'd like to have
updates as frequently as possible too.

Thanks in advance.

Mark


Nov 18 '05 #4

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

Similar topics

6
by: kevin | last post by:
Could someone explain, Caching. I understand Caching as simply saving a copy of something that is unlikely to change and to which you frequently refer as opposed to retrieving a fresh copy every...
0
by: Martin | last post by:
Hi. I had a very frustrating afternoon and evening but I have got it all under control now so all of a sudden I am in a good mood. I want to share some insights on output caching with you lot. ...
10
by: Jon Maz | last post by:
Hi, My goal is to take the entire html/javascript stream spat out by .aspx pages and save them as simple strings in a database (for caching purposes). I'm not sure how I can get hold of this...
10
by: BillGatesFan | last post by:
I'm trying to understand ASP.NET caching. I set the Page Output directive to VaryByParams= None and the duration = 60. Now whenever users hit my web app they can see each others data. Is there...
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...
4
by: DylanM | last post by:
I've seen a few examples on how to cache data in a WinForms GUI, just after some thought on the best solution. The data I'm trying to cache will be generally be small collections of Business...
5
by: Raj | last post by:
What is the purpose of file system caching while creating a tablespace? Memory on the test server gets used up pretty quickly after a user executes a complex query(database is already activated),...
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...
0
by: archana | last post by:
Hi all, Can someone tell me how the caching is implemented. Means how data is stored in output caching and data caching. If i am using output caching will that cache maintain on client side?...
3
by: Gary W. Smith | last post by:
I had a couple questions about data caching. We have a site that gets a huge amount of traffic to a few specific pages that have a lot of data on them (300k hits/hour during peak, about 6-10 data...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...

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.