Cover by Joe Conway, Aaron Hillegass

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

29Advanced MVCS

In this chapter, we’re going to add to Nerdfeed by adding support for caching and a way to indicate to users which posts have already been read.

Caching the RSS Feed

Each time the user fetches the Apple top songs RSS feed, the BNRFeedStore makes a web service request to Apple’s server. However, it takes time and battery power to make these requests. The data in this feed doesn’t change very often, either. Therefore, it doesn’t make much sense to make the resource-consuming request over and over again.

Instead, the store should save the results of the last request made. If the user tries to reload the feed within five minutes, the store won’t bother making the request and will just return the saved results. This process is known ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required