How to return HttpContext.Current.Cache from WCF?

前端 未结 3 1772
悲&欢浪女
悲&欢浪女 2021-01-19 03:25

I have a WCF service hosted in IIS and want to return the data which is reside in the cache of IIS (HttpContext.Current.Cache) What is the most appropriate choice of type th

3条回答
  •  离开以前
    2021-01-19 04:08

    You serialize your objects in order to transport them, but there's no need to cache serializable objects.

    Your service calls your business logic in order to process the requests but what gets over the wire should not be your business objects but your service's data contracts.

    Wrap your cache API and decouple it from the HttpRuntime Cache. As DrJokepu said, access asp.net cache through HttpRuntime.Cache if you choose so.

提交回复
热议问题