I have a table in sql server which I will query many times from the .net MVC code and I want to implement appfabric cache instead of sql server query(only for this query). How do I implement this? If the query is like- select address from people where id = @cid;
cid can be 1,2 or 3 which comes from the code
Do you really need AppFabric for this scenario ?
I mean, AppFabric Caching targets high volume web sites where database is a bottleneck and local caching is no longer a good choice. Yes, it's caching but for large data and distributed scenarios. In addition, you have to install additional dedicated servers for the caching tier.
Maybe a basic MemoryCache is enough to start : Local Cache, Nothing to install, no additional servers required and built-in support in .net bcl.
Here is a basic example :
For caching a small piece of data and for one (or a few) web servers, it's fairly enough.