473,387 Members | 1,583 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,387 software developers and data experts.

Update cache object

Hello All,

I save a Hashtable of stock symbols + prices to the cache. The prices
are updated every 30 minutes and saved to a database table.

I would like to always have the latest prices in the cache...is there
a way to dynamically update a cache object ?
Pointers appreciated
Thanks

Aug 16 '07 #1
2 1494
Do you want the latest price prior to saving to the database or the price
from the database?
"hharry" <pa*********@nyc.comwrote in message
news:11*********************@r34g2000hsd.googlegro ups.com...
Hello All,

I save a Hashtable of stock symbols + prices to the cache. The prices
are updated every 30 minutes and saved to a database table.

I would like to always have the latest prices in the cache...is there
a way to dynamically update a cache object ?
Pointers appreciated
Thanks

Aug 16 '07 #2
The basic pattern is as follows (pseudo-code):

1) get the "Stuff" - from the web, wherever
2) Store it in Cache with a timed expiration
3) Store it in the database if you want

Your "GetMyStuff" method will:
1) check if the cache item is null
2) if so, get the Stuff and update the Cache item
3) if not null, just get it right out of the Cache

This can all be done inside a single "getMyStuff" method so that the caching
part
is opaque to the user/ caller.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"hharry" wrote:
Hello All,

I save a Hashtable of stock symbols + prices to the cache. The prices
are updated every 30 minutes and saved to a database table.

I would like to always have the latest prices in the cache...is there
a way to dynamically update a cache object ?
Pointers appreciated
Thanks

Aug 17 '07 #3

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

Similar topics

2
by: André Heuer | last post by:
Hi, i want to write a .net class that can update my ip address at the dyndns service (http://www.dyndns.org). When I open the page...
4
by: SMG | last post by:
Hi there, I want to update my cached dataset, if there is any change in database. I know this is possible in case of ASP.Net 2.0 , But how do I execute the same task with ASP.Net 1.0 As there...
20
by: Janaka | last post by:
I tend to use the SqlDataAdapter class in WinForms projects because once the inital data is loaded any modifications can be easily added/updated through a call to the Update() method. I've found...
4
by: steroche | last post by:
I would REALLY appreciate help please please please! Im sure it is probably blindingly obvious to most of you but I am totally in the dark here!I am lost - i thought i had finally figured out this...
1
by: William Sullivan | last post by:
I'm trying to nail down some issues with the cache in my application. Currently, I have an object that stands between my business logic and database logic called CacheLogic (cute, no?). ...
2
by: andrew.roberts | last post by:
This is my second post now on this subject has I seem to be getting no where and the problem is really starting to bug me now. I can get a datagrid into an editable state but then neither the...
30
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data, from a database. One user changes the data and...
1
by: teenagelcruise | last post by:
hi, i have a problem with my code which is i cannot update and addnew data into the database but i can delete the data.plz give me an idea.this is my code that i wrote. <html> <head> <meta...
3
by: mrutyunjaya | last post by:
if (Cache==null) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings.ConnectionString); SqlDataAdapter mydataadapter = new...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
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...

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.