Caching WCF client-side with .NET4

允我心安 提交于 2019-12-11 04:29:25

问题


I have a set of entities which which will be retrieved from service. Some of them are static, so i decided to create a client-side cache. But i can not find the point to insert caching. I have svcutil generated proxies and i need to enable caching for some of them (not all). My point is to make some mechanism, that will work in channelFactory/clientBase level and will cache all required entities.

What i want:

  • transparent caching without business logic changing (in common or at all)

  • configuring cacheable entities with some kind of attribute: [Cacheable]

  • ability to add caching implementation: MemoryCache, DistributedCache


回答1:


Whereas, it's very easy to create a Caching Attribute using IOperationInvoker on the service (check an example here), it's very difficult to do the same on client side.

The best example that I've seen is from Paolo Salvatori, available here. Great solution, but I finally gave up because of the complexity. I turned myself to a generic wrapper for WCF calls. There are still manual tasks but it's simpler and I can easily manage it.




回答2:


what about caching with Castle Windsor integration facility? you can intercept and implement cache client side (i did it). weak side: i think this project is not well documented, and also i dont really know how alive it is.

http://docs.castleproject.org/Windsor.WCF-Integration-Facility.ashx



来源:https://stackoverflow.com/questions/17021035/caching-wcf-client-side-with-net4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!