# Caching html / blobs / ActiveRecords

**URL:** <https://www.ruby-forum.com/t/caching-html-blobs-activerecords/186689>\
**Category:** Rails\
**Created:** [April 11, 2010, 4:46pm UTC](https://www.ruby-forum.com/t/caching-html-blobs-activerecords/186689 "2010-04-11T16:46:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fearless\_fool](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5e9695/32.png) [@fearless\_fool](https://www.ruby-forum.com/u/fearless_fool)\
**Post date:** [April 11, 2010, 4:46pm UTC](https://www.ruby-forum.com/t/caching-html-blobs-activerecords/186689/1 "2010-04-11T16:46:25Z")

</div>

Short question: what caching packages are available for Rails?

Details: My application requires data scraped from various web sites.  
To date, I’ve used scripts to fetch the page in question. Since I never  
want to hit a web site twice with the same query, I always save the raw  
HTML so I can parse it later (e.g. if I need to rebuild my database). I  
then parse the stored HTML and load the results into ActiveRecords:

Web S. =\> [mechanize] =\> stored HTML =\> [parse and save!] =\>  
ActiveRecord

I’d like to automate this so if MyActiveRecord.find() doesn’t turn up  
anything, it will first look for stored HTML, and if it can’t find any  
stored HTML will trigger a fetch from the web site.

Before I write this from scratch, I should ask: are there any caching  
packages for Rails that do some or all of this?

TIA.

- ff
