# Can I expire a cached page using a regex?

**URL:** <https://www.ruby-forum.com/t/can-i-expire-a-cached-page-using-a-regex/57403>\
**Category:** Rails\
**Created:** [April 10, 2006, 5:56pm UTC](https://www.ruby-forum.com/t/can-i-expire-a-cached-page-using-a-regex/57403 "2006-04-10T17:56:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![beachguy82](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@beachguy82](https://www.ruby-forum.com/u/beachguy82)\
**Post date:** [April 10, 2006, 5:56pm UTC](https://www.ruby-forum.com/t/can-i-expire-a-cached-page-using-a-regex/57403/1 "2006-04-10T17:56:54Z")

</div>

I’m trying to expire all pages under my view action. These could  
be /controller/view/1 or /controller/view/1/2

how can I expire all pages under /controller/view/? There must be a  
way, but I’m stumped. Here’s my broken attempt. Thanks in advance for  
any help,suggestions, or directions to a how to page.

expire\_action(:controller =\> ‘/pragmatic’,  
:action =\> ‘view’,  
:id =\> %r{\d\*},  
:page =\> %r{\d\*})

---

<div class="post-metadata">

**Author:** ![beachguy82](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@beachguy82](https://www.ruby-forum.com/u/beachguy82)\
**Post date:** [April 10, 2006, 7:44pm UTC](https://www.ruby-forum.com/t/can-i-expire-a-cached-page-using-a-regex/57403/2 "2006-04-10T19:44:48Z")

</div>

Still no luck here. I’ve also tried this but all it did was expire the  
view.html page  
expire\_action(:controller =\> ‘/pragmatic’,  
:action =\> ‘view’)

---

<div class="post-metadata">

**Author:** ![beachguy82](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@beachguy82](https://www.ruby-forum.com/u/beachguy82)\
**Post date:** [April 10, 2006, 8:15pm UTC](https://www.ruby-forum.com/t/can-i-expire-a-cached-page-using-a-regex/57403/3 "2006-04-10T20:15:27Z")

</div>

I’m interested in this as well… however for right now, I’ve taken this  
approach and modified it to suit my needs:

[http://www.fngtps.com/2006/01/lazy-sweeping-the-rails-page-cache](http://www.fngtps.com/2006/01/lazy-sweeping-the-rails-page-cache)

---

<div class="post-metadata">

**Author:** ![beachguy82](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@beachguy82](https://www.ruby-forum.com/u/beachguy82)\
**Post date:** [April 10, 2006, 8:34pm UTC](https://www.ruby-forum.com/t/can-i-expire-a-cached-page-using-a-regex/57403/4 "2006-04-10T20:34:02Z")

</div>

Thanks, it seems that is the route I’ll go untill I figure out how to  
just delete specific files under the public/controller/action directory.
