Hi guys:
i got a problem on caching my pages:
in my Sweeper i wrote:
class MySweeper < ActionController::Caching::Sweeper
observe Post
def after_save(post)
expire_page(:controller => ‘post’, :action => ‘show’, :id =>
post.id)
cache_page(:controller => ‘post’, :action => ‘show’, :id =>
post.id)
end
end
The problem is ‘cache_page’ NOT work while the ‘expire_page’ works
fine:
when i open the url: /post/show/id , a cache page is created in public/
post/show/ folder.
then i edit the post, the cache page was cleared by the sweeper, but
it does not be created until i reopen the show page url in brower.
this problem occured in my controller too …
any help idea? or i just misunderstand the ‘cache_page’ method?
thanks for help
– shawn
shawn shao wrote:
The problem is ‘cache_page’ NOT work while the ‘expire_page’ works
fine:
when i open the url: /post/show/id , a cache page is created in public/
post/show/ folder.
then i edit the post, the cache page was cleared by the sweeper, but
it does not be created until i reopen the show page url in brower.
this problem occured in my controller too …
any help idea? or i just misunderstand the ‘cache_page’ method?
thanks for help
– shawn
The cache is only created when the acutla page is rendered again…
it works as intended…
Mikkel wrote:
The cache is only created when the acutla page is rendered again…
it works as intended…
Thanks for reply, Mikkel~~
so is there any way i can generate a cache page without rendering the
url page,
Or can i ‘pretend’ rendering it after save() action in my controller?
On 01 Jun 2007, at 12:41, Shawn Shao wrote:
so is there any way i can generate a cache page without rendering the
url page,
Or can i ‘pretend’ rendering it after save() action in my controller?
Although I would advise against it, you could issue a “curl “+url_for
(…)+” > /dev/null” using ruby’s system command to load the page.
Best regards
Peter De Berdt