Cache feed and only refresh when feed is changed
Over at rsscache they have a way of refreshing the cache onl开发者_如何学运维y when the feed has changed. Unfortunately its .Net.
I would like to know what approach I should take to achieve this in php.
How are changes in the feed detected? Simply by a timestamp (time node in the beginning of the feed)?
My feed would be a yahoo pipe that has mixed many feeds together. So either the yahoo feed must generate a combined timestamp, or my cache mechanism must automagically detect if the pipe has changed.
You have to:
- Store when the content you have cache was last stored (read the server's Last-modifiedheader).
- Make conditional GET requests (send the header If-modified-since).
The server will either respond with 200 (OK) and the content or 304 (Not Modified) and an empty response body.
See RFC 2616.
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论