# How to write a page to the cache from a cache sweeper

**URL:** <https://www.ruby-forum.com/t/how-to-write-a-page-to-the-cache-from-a-cache-sweeper/91949>\
**Category:** Rails\
**Created:** [April 13, 2007, 6:44pm UTC](https://www.ruby-forum.com/t/how-to-write-a-page-to-the-cache-from-a-cache-sweeper/91949 "2007-04-13T18:44:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BallS\_Donald\_A\_Jr\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@BallS\_Donald\_A\_Jr\_S](https://www.ruby-forum.com/u/BallS_Donald_A_Jr_S)\
**Post date:** [April 13, 2007, 6:44pm UTC](https://www.ruby-forum.com/t/how-to-write-a-page-to-the-cache-from-a-cache-sweeper/91949/1 "2007-04-13T18:44:55Z")

</div>

I’ve got an expensive page which I want to store in the page cache. The  
conditions under which it needs to be updated are such that it requires  
use of a sweeper object, no challenge there. The wrinkle is this:  
instead of simply expiring the page in the sweeper and lazily waiting  
until the next user requests the page to generate it, I’d like to go  
ahead and regenerate the page in the sweeper. Any tips on how I’d go  
about doing that?

- donald
