如何做WCF REST缓存? [英] How to do WCF REST Caching?

查看:93
本文介绍了如何做WCF REST缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WCF REST服务,该服务需要根据客户端(胖窗口客户端)传递的参数返回静态数据和一些经过过滤的数据

I have a WCF REST service which needs to return both Static and some filtered data based on what parameters were passed in by the clients(which are fat windows clients)

由于提供此服务的数据存储不会经常更改,因此我想将此数据缓存在服务上(服务器端缓存),该数据存储是Azure表,我知道WCF REST入门工具包具有用于缓存的Web缓存,但它需要一个web.config条目来进行固定持续时间的缓存(例如:30分钟)。每当我的azure表条目更改时,我都想在代码中执行此操作。我该怎么做到?

Since the data store which feeds this service doesnt change too often, I wanted to cache this data on the service(Server side caching), The data store is an Azure Table, I know WCF REST Starter kit has Web Cache for caching but it needs a web.config entry to do a fixed duration caching(ex: 30mins). I wanted to do this in code whenever my azure table entry changes. How can I accomplish this?

此外,由于我需要根据传入的参数对服务进行一些处理/过滤,因此我似乎必须创建2个方法,一种带有缓存的私有方法来获取数据,另一种用于处理/过滤并发送回结果。

Also Since I have some processing/filtering to do on my service based on the parameters passed in, seems like I would have to create 2 methods, one private method with caching to get the data and the other one to process/filter and send back the results. Correct?

推荐答案

查看有关该主题的各种博客文章:

Check out some of the various blog post on the topic:

  • REST in WCF – Part X – Supporting Caching and Conditional GET
  • Adding caching to WCF RESTful services using the REST Starter Kit
  • Caching support for WCF REST services (.NET 4 beta)

也请查看官方 MSDN WCF REST开发人员中心以获取更多信息。

Also check out the official MSDN WCF REST developer center for more information.

这篇关于如何做WCF REST缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆