# Caching html pages - which is better: blobs or files?

**URL:** <https://www.ruby-forum.com/t/caching-html-pages-which-is-better-blobs-or-files/187087>\
**Category:** Rails\
**Created:** [April 16, 2010, 6:37pm UTC](https://www.ruby-forum.com/t/caching-html-pages-which-is-better-blobs-or-files/187087 "2010-04-16T18:37:39Z")\
**Posts on this page:** 2\
**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 16, 2010, 6:37pm UTC](https://www.ruby-forum.com/t/caching-html-pages-which-is-better-blobs-or-files/187087/1 "2010-04-16T18:37:39Z")

</div>

I’ve written a simple package for caching pages I’ve fetched from the  
web. It works like a champ, and makes it so I don’t have to hit a  
server multiple times.

I’m wondering whether it’s better to store the cached pages in my db  
(I’m using mysql) or in the file system. Either approach is  
straightforward, but do people have experiences or even strongly held  
beliefs as to which is better?

The floor is open…

- ff

---

<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 16, 2010, 7:24pm UTC](https://www.ruby-forum.com/t/caching-html-pages-which-is-better-blobs-or-files/187087/2 "2010-04-16T19:24:36Z")

</div>

> I’ve written a simple package for caching pages I’ve fetched from the  
> web. It works like a champ, and makes it so I don’t have to hit a  
> server multiple times.
> 
> I’m wondering whether it’s better to store the cached pages in my db  
> (I’m using mysql) or in the file system. Either approach is  
> straightforward, but do people have experiences or even strongly held  
> beliefs as to which is better?

The moment you want to access those cached pages from another server,  
you’ll want them in the database. Similarly, if you want to add any  
meta data.

But until then… I’d be inclined to just dump them to disk.

Just write your library so that the code doing the processing doesn’t  
care where it is… then it will be easy to switch later.
