How to Cache Data and Preload The Cache in Rails

Courtenay has come up with an ingenious solution to caching and precaching in Ruby on Rails with memcached. It caches data from database requests, as you'd expect, but you can also put together a special forking method that caches data in advance. Courtenay's suggestion for this is if a user does a search and you cache the initial page of search results, you could speculate the user might progress onto page two of the search, so you can get Rails to precache that data in advance so the next page load is blazing fast.