How do I cache Linq-based IQueryable webservice (WCF) data in Appfabric Caching
-
4 martie 2012 19:55
There is sample code in the Telerik site below that uses WCF to access the database.
How should I modify the code to take advantage of Azure Caching?
Toate mesajele
-
4 martie 2012 19:59
It's quite unclear what you exactly are looking for. Providing more information could be useful.
I wrote a blog post that contains everything you need to know to use Windows Azure caching service:
http://robbincremers.me/2012/02/23/using-windows-azure-caching-service-to-improve-performance-for-your-cloud-services/You will find how to create and work with the caching service, how to use the DataCacheFactory and how to work with the local cache. You'll have to write some code in your ASMX or WCF service to provide the popular non-volatile data from the cache instead of from the database. If it's not in the cache, you retrieve it from the database and put it in the cache. But you can find everything you need in the post.
Make sure to read the parts that explain the drawbacks of using Windows Azure caching service. Using a properly timeout based invalidation is important.
In the Telerik demo case you presented, they retrieve the grid data from the GetOrders method, which you should add some custom logic. If this is not what you are looking for, please provide some information what you are looking for so we are on the same page.
Be nice to nerds ... Chances are you'll end up working for one!
- Editat de Robbin Cremers 4 martie 2012 20:02
-
5 martie 2012 16:09
I understand the symantics of Azure caching, but there is something in the WCF (??OData??) pipeline that needs to be altered in order to support the cache.
In the source code I linked to, I do some processing and send it to a Telerik object so the IQueryable can be futher manipulated.
I need to get the final query, and right before execution determine if it's in cache or not. That is where I"m stuck
-
6 martie 2012 06:17Moderator
Hi,
The link you given seems to be an ASP.NET application. If you’re using ASP.NET, you can use output caching. This is supported by Windows Azure caching. I would like to suggest you to check http://msdn.microsoft.com/en-us/library/windowsazure/gg185662.aspx for more information. Essentially, with output caching, we don’t care where the data comes from (WCF, database, or somewhere else). The page generated by ASP.NET itself is cached. OData can also put its query result into ASP.NET output caching: http://blogs.msdn.com/b/peter_qian/archive/2010/11/17/using-asp-net-output-caching-with-wcf-data-services.aspx. As for WCF SOAP Services, we can manually work with the caching API to put whatever we want into cache. Please refer to http://msdn.microsoft.com/en-us/library/windowsazure/gg618003.aspx for more information.
Best Regards,
Ming Xu.
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework- Marcat ca răspuns de Arwind - MSFTModerator 14 martie 2012 03:23