Can I cache my table storage calls in azure?
I am using Windows Azure table storage. I have a lot of look ups to the same rows and these row has data which rarely changes. I know recently t开发者_StackOverflow社区he cloud team have come up with some enhancements but I've not had the chance to use any of them yet.
With what's new is there a way that I can now cache my requests to table storage and if so then how easy is this to set up?
I believe you're referring to the recently-released AppFabric Cache (caching-as-a-service). It's very easy to set up and use. Essentially:
- Visit the Windows Azure portal (http://windows.azure.com)
- Provision a cache namespace
- Add the cache assemblies to your app
- Add the cache namespace and key to your web.config
- In code, create a cache factory and get an instance of the factory
- Call
cache.Put()
to add a key/value pair, andcache.Get(key)
to retrieve a value
Watch this intro video to see a full example. While this example shows twitter feed retrievals, you could just as easily retrieve table entities and put them into the cache.
There's also an AppFabric Cache lab in the Windows Azure Platform Training Kit. For info on pricing and SLA, look at the AppFabric Cache FAQ.
精彩评论