There is a web service which pushes dataset (or XML data).I have a web page and I am displaying those data from this dataset on a web page.This web service updates the data occasionally. (not on a periodic basis) There will be approx. 300 users which
will display this web page from different PCs. So here are the questions. Since data is occasionally updated, is it appropriate to use caching? (What kind of cahcing SQL etc) How would I get the updated data and display it on my page? Should I use a timer?
If I use a timer,do I miss the currently updated data? and of course should I store the data in a table?
I would be so grateful if you can help me.
Best Regards.
Keep your friends close and your enemies even closer
Yeah I think this is a good fit for caching..also you would not need to implement a timer..
The Cache object has an overloaded callback parameter, basically a delegate to a method which can be called when the object expires, so either one uses absolute or sliding scale expiration, once the cache expires, the method would be invoked and could be
used to fill back the cache object.
Wouldn't it be more appropriate to use SqlDependency cache? Because I would like to insert those data into a table everytime it is updated. So cache is only flushed when the data changes in the table?
Keep your friends close and your enemies even closer
Yes that is another way, I think its used majorly for chatty clients and also there's the setup cost of enabling cache dependency in the database...I have a liking to the Cache object as the control is contained via one system and the call back works efficiently..
How is the data updated? Through the use of the web site or web service? If so, then you could always call a refresh of the cache when the function for updating the data has completed successfully.
cenk1536
Contributor
2503 Points
2119 Posts
What would you do to implement such a scenario???
Apr 17, 2012 04:32 PM|LINK
Hi,
There is a web service which pushes dataset (or XML data).I have a web page and I am displaying those data from this dataset on a web page.This web service updates the data occasionally. (not on a periodic basis) There will be approx. 300 users which will display this web page from different PCs. So here are the questions. Since data is occasionally updated, is it appropriate to use caching? (What kind of cahcing SQL etc) How would I get the updated data and display it on my page? Should I use a timer? If I use a timer,do I miss the currently updated data? and of course should I store the data in a table?
I would be so grateful if you can help me.
Best Regards.
ignatandrei
All-Star
135231 Points
21695 Posts
Moderator
MVP
Re: What would you do to implement such a scenario???
Apr 18, 2012 04:47 AM|LINK
Yes. Asp.NET caching( see Cache in asp.net)
cenk1536
Contributor
2503 Points
2119 Posts
Re: What would you do to implement such a scenario???
Apr 18, 2012 05:39 AM|LINK
Hi ignatandrei,
Thanks for your reply, what about the other questions? What would you do?
Srikanth Kas...
Contributor
4289 Points
883 Posts
Re: What would you do to implement such a scenario???
Apr 18, 2012 05:53 AM|LINK
- Cache your data and make the database call after stipulated time (When you feel that data gets updated).
http://www.codeproject.com/Articles/6158/Caching-in-ASP-NET
Srikanth Kasturi
Please "Mark As Answer" if my post serves purpose.
cenk1536
Contributor
2503 Points
2119 Posts
Re: What would you do to implement such a scenario???
Apr 18, 2012 05:59 AM|LINK
But there is no certain time for the data update. I am planning to implement a timer and check the data lets say for every minute.
groverg
Member
26 Points
10 Posts
Re: What would you do to implement such a scenario???
Apr 18, 2012 06:11 AM|LINK
Yeah I think this is a good fit for caching..also you would not need to implement a timer..
The Cache object has an overloaded callback parameter, basically a delegate to a method which can be called when the object expires, so either one uses absolute or sliding scale expiration, once the cache expires, the method would be invoked and could be used to fill back the cache object.
The code sample is explained at the below link
http://msdn.microsoft.com/en-us/library/system.web.caching.cacheitemremovedcallback.aspx
cenk1536
Contributor
2503 Points
2119 Posts
Re: What would you do to implement such a scenario???
Apr 18, 2012 06:27 AM|LINK
Wouldn't it be more appropriate to use SqlDependency cache? Because I would like to insert those data into a table everytime it is updated. So cache is only flushed when the data changes in the table?
groverg
Member
26 Points
10 Posts
Re: What would you do to implement such a scenario???
Apr 18, 2012 06:43 AM|LINK
Yes that is another way, I think its used majorly for chatty clients and also there's the setup cost of enabling cache dependency in the database...I have a liking to the Cache object as the control is contained via one system and the call back works efficiently..
niceastham
Member
645 Points
175 Posts
Re: What would you do to implement such a scenario???
Apr 18, 2012 07:10 AM|LINK
How is the data updated? Through the use of the web site or web service? If so, then you could always call a refresh of the cache when the function for updating the data has completed successfully.
cenk1536
Contributor
2503 Points
2119 Posts
Re: What would you do to implement such a scenario???
Apr 18, 2012 11:00 AM|LINK
Hi
I set up a sql cache dependency to sql server 2005. It works OK. But how would I refresh the page everytime the data is updated?
Best Regards