# Expire a page and its children?

**URL:** <https://www.ruby-forum.com/t/expire-a-page-and-its-children/107453>\
**Category:** Radiant CMS\
**Created:** [June 21, 2007, 11:03pm UTC](https://www.ruby-forum.com/t/expire-a-page-and-its-children/107453 "2007-06-21T23:03:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpheath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/73ab20/32.png) [@rpheath](https://www.ruby-forum.com/u/rpheath)\
**Post date:** [June 21, 2007, 11:03pm UTC](https://www.ruby-forum.com/t/expire-a-page-and-its-children/107453/1 "2007-06-21T23:03:46Z")

</div>

Is there an easy way to expire a page and all its children?

For example, this page: [http://biola.artofmission.com/news/](http://biola.artofmission.com/news/) and all  
its children need to be expired whenever a new page is posted in the  
news section.

I was just going to do ResponseCache.instance.expire\_response  
(page.url) recursively, but I was hoping there was a more elegant way  
to do it.

thanks,  
ryan

---

<div class="post-metadata">

**Author:** ![rpheath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/73ab20/32.png) [@rpheath](https://www.ruby-forum.com/u/rpheath)\
**Post date:** [June 21, 2007, 11:23pm UTC](https://www.ruby-forum.com/t/expire-a-page-and-its-children/107453/2 "2007-06-21T23:23:48Z")

</div>

Ryan,

Unfortunately that’s the only way to do it currently, assuming the  
structure of your pages requires this. Unless you’re modifying the  
cache length, the changes will propagate in 5 minutes, of course.

Sean

---

<div class="post-metadata">

**Author:** ![rpheath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/73ab20/32.png) [@rpheath](https://www.ruby-forum.com/u/rpheath)\
**Post date:** [June 21, 2007, 11:23pm UTC](https://www.ruby-forum.com/t/expire-a-page-and-its-children/107453/3 "2007-06-21T23:23:48Z")

</div>

I guess also, I’d need to be able to expire a page’s parent, and all  
the parent’s children. The case where that would be necessary is if  
the title of the page was changed, so you’d need to regenerate the  
navigation on all the pages in that section.

On Jun 21, 2007, at 4:02 PM, Ryan H. wrote:

> thanks,  
> ryan
> 
> * * *
> 
> Radiant mailing list  
> Post: removed\_email\_address@domain.invalid  
> Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)  
> Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)

* * *

Ryan H.  
Art of Mission, Inc.  
3720 Gattis School Rd #800 PMB 245  
Round Rock, TX 78664

800-722-1492 (phone)

[www.artofmission.com](http://www.artofmission.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![rpheath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/73ab20/32.png) [@rpheath](https://www.ruby-forum.com/u/rpheath)\
**Post date:** [June 21, 2007, 11:35pm UTC](https://www.ruby-forum.com/t/expire-a-page-and-its-children/107453/4 "2007-06-21T23:35:49Z")

</div>

I guess at that point it’s almost easier to expire the entire cache! 😉

Sean

---

<div class="post-metadata">

**Author:** ![rpheath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/73ab20/32.png) [@rpheath](https://www.ruby-forum.com/u/rpheath)\
**Post date:** [June 22, 2007, 12:15am UTC](https://www.ruby-forum.com/t/expire-a-page-and-its-children/107453/5 "2007-06-22T00:15:57Z")

</div>

Sean,

> I guess at that point it’s almost easier to expire the entire  
> cache! 😉

That’s a great point, but the only reason that I don’t want to expire  
the whole cache is because it takes forever to regenerate each page.  
I think the slowness is due to the way I have my navigation set up,  
since it is doing a lot of iteration with if\_children and  
if\_ancestor\_or\_self to build the navigation and sub-navigation menus.  
At this point it takes as long as 2 seconds to render a page after  
the cache is expired.

So I guess the issue is not how to creatively expire the cache, but  
how to speed up the rendering of the navigation.

Has anyone done hierarchical navigation like this before? Is there a  
more efficient way to do it?

Thanks!

On Jun 21, 2007, at 4:34 PM, Sean C. wrote:

> > > I was just going to do ResponseCache.instance.expire\_response  
> > > Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)
> 
> * * *
> 
> Radiant mailing list  
> Post: removed\_email\_address@domain.invalid  
> Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)  
> Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)

* * *

Ryan H.  
Art of Mission, Inc.  
3720 Gattis School Rd #800 PMB 245  
Round Rock, TX 78664

800-722-1492 (phone)

[www.artofmission.com](http://www.artofmission.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![rpheath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/73ab20/32.png) [@rpheath](https://www.ruby-forum.com/u/rpheath)\
**Post date:** [June 22, 2007, 10:41am UTC](https://www.ruby-forum.com/t/expire-a-page-and-its-children/107453/6 "2007-06-22T10:41:50Z")

</div>

Il giorno 21/giu/07, alle ore 23:02, Ryan H. ha scritto:

> Is there an easy way to expire a page and all its children?
> 
> For example, this page: [http://biola.artofmission.com/news/](http://biola.artofmission.com/news/) and all  
> its children need to be expired whenever a new page is posted in the  
> news section.

You can use the dynamic extension:

[http://darcs.bigchieflabs.com/radiant/extensions/dynamic/rdoc/](http://darcs.bigchieflabs.com/radiant/extensions/dynamic/rdoc/)

You set Dynamic as page type of News…and when you add/remove/update  
a page under news, the page cache is cleared automatically…is it  
what you need?

* * *

Andrea F.

removed\_email\_address@domain.invalid  
[http://bigchieflabs.com/blog/](http://bigchieflabs.com/blog/)  
[http://think.bigchief.it](http://think.bigchief.it)

---

<div class="post-metadata">

**Author:** ![rpheath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/73ab20/32.png) [@rpheath](https://www.ruby-forum.com/u/rpheath)\
**Post date:** [June 22, 2007, 10:48am UTC](https://www.ruby-forum.com/t/expire-a-page-and-its-children/107453/7 "2007-06-22T10:48:50Z")

</div>

> I was just going to do ResponseCache.instance.expire\_response (  
> page.url) recursively, but I was hoping there was a more elegant way to  
> do  
> it.

```
Is there a way to execute arbitrary Ruby code directly inside a tag? 

```

Or  
you are modifying a .rb file?

```
/AITOR
```
