IMPORTANT: This is for Monologue BEFORE 0.4. Do not use this with 0.4 & up
You've been able to turn on page caching with Monologue since the first release (0.1), but you now need a few more configurations to enable it starting with 0.2. Also, it now comes bundled with a smarter use of page caching, still not rocket science, but that could help for a lot of people.
To enable the use of page caching for Monologue, you must add this line in your
Monologue::PageCache.enabled = true
You also need to enable caching in your Rails project (in
ActionController::Base.perform_caching = true
There is now an optional auto-wipe after any save of published posts and also a cache management section in admin. You can completely wipe cache from that section if needed. Finally, there is a rake task to clear up the full cache. You could add a cron job to clear cache every, say, X minutes or hours.
Monologue::PageCache.wipe_enabled = true # this alone will enable cache management's UI and rake task, but not automatic wipe after save. Monologue::PageCache.wipe_after_save = true # **needed** for automatic wipe after saving a published post.
Make sure that
config/environments/production.rb is set to a safe directory to completely wipe. It will wipe the whole directory. Let me say this again: it will wipe the whole directory. It will not work with the Rails public directory, it must be any other directory.
I suggest to have something like
config.action_controller.page_cache_directory = Rails.public_path + "/my-cache-dir"
Simply call it like any other rake task:
bundle exec rake monologue:cache:wipe
I suggest the great whenever gem to set it as a cron job.
IMPORTANT: if monologue is mounted at root ("/"), you must also add that in your
routes.rb file, before the monologue mount:
root to: 'monologue/posts#index'
Last edited by Jean-Philippe Boily,