CHAPTER 20 WEB SERVICES Figure 20-4. Limiting (Web hosting compare)

CHAPTER 20 WEB SERVICES Figure 20-4. Limiting the number of headlines for each feed Caching Feeds One final topic to discuss regarding Magpie is its caching feature. By default, Magpie caches feeds for 60 minutes, on the premise that the typical feed will likely not be updated more than once per hour. Therefore, even if you constantly attempt to retrieve the same feeds, say once every 5 minutes, any updates will not appear until the feed cache is at least 60 minutes old. However, some feeds are published more than once an hour, or the feed might be used to publish somewhat more pressing information. (RSS feeds don t necessarily have to be used for browsing news headlines; you could use them to publish information about system health, logs, or any other data that could be adapted to its structure. It s also possible to extend RSS as of version 2.0, but this matter is beyond the scope of this book.) In such cases, you may want to consider modifying the default behavior. To completely disable caching, disable the constant MAGPIE_CACHE_ON, like so: define(’MAGPIE_CACHE_ON’, 0); To change the default cache time (measured in seconds), you can modify the constant MAGPIE_CACHE_AGE, like so: define(’MAGPIE_CACHE_AGE’,1800); Finally, you can opt to display an error instead of a cached feed in the case that the fetch fails, by enabling the constant MAGPIE_CACHE_FRESH_ONLY: define(’MAGPIE_CACHE_FRESH_ONLY’, 1)
Check Tomcat Web Hosting services for best quality webspace to host your web application.

Leave a Reply