RSS:刷新率? [英] RSS: refresh rate?

查看:89
本文介绍了RSS:刷新率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个小应用程序供我自己使用,它将使用公开发布的 RSS 提要.

I'm writing a little application for my own use which will consume a publicly published RSS feed.

据我所知,协议中没有订阅/发布机制;我需要让我的应用程序定期 HTTP-GET RSS 提要.

As far as I can tell, there's no subscribe/post mechanism in the protocol; I need to have my application HTTP-GET the RSS feed periodically.

如果是这样的话,我想每十分钟左右来一次,但我担心被视为施虐者.如果我连续几周看到有人每隔十分钟戳我的服务器,我肯定会担心.

If that's the case, I'd like to grab it every ten minutes or so, but I'm worried about being seen as an abuser. I'd certainly be concerned if I saw someone poking my server every ten minutes for weeks on end.

这是一个有效的问题吗?关于什么是合理"的刷新率,是否有任何一般性建议?我的事实是否直截了当?

Is this a valid concern? Is there any general advice on what a "reasonable" refresh rate is? Do I even have my facts straight?

推荐答案

由于 RSS 是建立在 HTTP 协议之上的,所以一般来说,大多数站点应该尊重 If-Modified-Since HTTP 标头.这是相当轻量级的,大多数服务器应该能够快速返回此信息.

Since RSS is built on the HTTP protocol, in general, most sites should respect the If-Modified-Since HTTP header. This is fairly lightweight and most servers should be able to return this information quickly.

因此,对于客户端,您需要跟踪上次发送请求并将其传递给服务器的时间.如果服务器返回 304 代码,那么您就会知道什么都没有改变.但更重要的是,服务器不需要返回提要信息,从而节省了流量字节.如果服务器返回 200,则您需要处理结果并保存响应日期.

So for the client-side, you'll need to keep track of the last time you've sent the request and pass it to the server. If the server returns a 304 code, then you'll know that nothing has changed. But even more importantly, the server doesn't need to return the feed info, saving bytes of traffic. If the server returns a 200, then you'll need to process the results and save the response date.

最终,这个问题的答案取决于 RSS 提要另一端的信息类型.如果是博客,那么大概每 4-8 小时一次就足够了.但如果 R​​SS 提要是股票报价提要(不太可能,只是一个例子),那么每 10 分钟是不够的.

Ultimately, the answer to this question depends on what type of information is at the other end of the RSS feed. If it is a blog, then probably once every 4-8 hours is sufficient. But if RSS feed is a feed of stock quote (not likely, just an example), then every 10 minutes is not sufficient.

这篇关于RSS:刷新率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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