Topic: Unable to expire a page cache from my admin section

hi all

I'm  having a bit of a confusing issue with the application I have just built, I am playing with page caching, however I cant seem to expire the cached page when updating or creating a new item in the admin section I have built.

for instance I have an articles controller which has:

caches_page :index

and in the create and update actions in the admin articles controller I have done:

expire_page :action => :index

I can see why this isn't working as it clears a non existent "/admin/articles.html" but all the ways I have tried to get it to expire the cached page so far have not been fruitful, I have also tried using a sweeper but again this tries to clear a non existent "/admin/articles.html"  can anyone shed some light on what I need to do?

Thanks

Yorkie smile

Last edited by yorkie-t (2010-02-11 09:09:20)

Re: Unable to expire a page cache from my admin section

Yorkie,

According to the API docs http://api.rubyonrails.org/classes/Acti … ml#M000451 you can expire the cache by using the path as a key:

expire_page "/articles"

Does that do the trick?

Chris

Re: Unable to expire a page cache from my admin section

sorry I forgot to post up but I figured out what I was doing wrong, basically I needed to pass the controller too so that it knew it wasn't expiring something in the admin section, like so:

expire_page :controller =>"/articles", :action =>"index"

however I may still give your suggestion a try as I believe that would work too.

thanks smile