How to expire cache part using rake task in rails3?

538 Views Asked by At

I am creating a application, rails3 with ruby 1.9.2. I have a left menu with some blog posts. This is displaying in every page in my application, so I am using cache concept in views. That blog posts update in database every day using rake task.

In rake task database update everyday first hour, after update database I want to clear that cache part from rake task. Any one help how to write rake task for expiring cache.

1

There are 1 best solutions below

1
phoet On

use a cronjob for your rake tast: https://github.com/javan/whenever

expire fragments with a sweeper: http://guides.rubyonrails.org/caching_with_rails.html#sweepers