问题
We have typical ASP.NET application with a web app & a phone client app which talks to a WCF Service which uses a SQL Server database. Currently we have only once instance of WCF service hosted in IIS but may decide to deploy to a webfarm in future.
We would like to cache relational data in a cache in WCF service side, that way both web app and phone app can benefit from it. WCF service is purely stateless and we need to keep it that way.
With those constraints, what are available technologies/solutions/thirdparty components that we can use to implement the caching on WCF service. Which ones work best in a webfarm scenario?
回答1:
Have you looked at Windows Server AppFabric? It will scale across your web farm and should be compatible with most server-based .NET solutions.
We use it quite extensively across our projects and it works quite well.
回答2:
There are a few third party options here:
NCache
Memcached
Redis
AppFabric
This is just a few but there are others out there.
回答3:
NCache can be a better option here. all you have to do is to create a caching tier in between WCF and SQL Server and then populate data in cache. All the subsequent request of this data will be severed by cache.
Read the below mentioned article which will further clarify the concept of WCF caching.
Scalable WCF Applications Using Distributed Caching
来源:https://stackoverflow.com/questions/9778533/distributed-caching-solution-for-wcf-service