views:

453

answers:

3

A webservice i'm working with sends back a result set that equates to around 66980 lines of XML, .net returns this as a list object.

As the user journey requires that we can reload this set if they step back a page, whats the fastest/best way of storing this result set per-user without slowing everything down.

Ta

-- many solutions: http://msdn.microsoft.com/en-us/magazine/cc300437.aspx

+1  A: 

I would use memcache as a general way of caching queries. Best is that it works across nodes (in case you have more webservers).

Toad
Is there any advantage in using memcache over HttpContext.Current.Cache or say Session
Chris M
memcache can be used from multiple nodes (webservers). This way, every webserver is not calculating every (already known) answer again.
Toad
Thanks, we only have 1 server for this project and the resultset is randomised from 13000(ish) records or so and 500 returned so it has to be restricted to cache-per-user.
Chris M
+1  A: 

Save it to HttpContext.Current.Cache, keyed on the user id, possibly something like "MyXml_UserId".

DeletedAccount
Is there any advantage in using HttpContext.Current.Cache over memcache or say Session
Chris M
Depends on your hosting arcitecture. I'd avoid session as it's confined to the sole page server, (unless you save it back to db). if you only host on one, session would probably be ok. I don't know about memcache.
DeletedAccount
Session can be automatically backed by SQL Server, or to a separate state server.
John Saunders
Yup: "(unless you save it back to db)"
DeletedAccount
Both answers are technically correct; it doesn't quite answer which is faster but I think there's very little between the two so I've ticked the one I'm currently using for testing. -- Many thanks
Chris M
A: 

I'll just note here that your issue is not unique to web services. You might as easily have retrieved that list from a database, and you'd still want to cache it so you don't have to go to the database again.

John Saunders
True, I figured I'd be overly verbose.
Chris M
No, the new title is fine.
John Saunders