rails / actionpack-action_caching

Action caching for Action Pack (removed from core in Rails 4.0)
MIT License
262 stars 96 forks source link

expiring an action cache #53

Open mzaragoza opened 7 years ago

mzaragoza commented 7 years ago

I added this to my project and its working fine but I am having a problem expiring the cache

my controller looks like

class PostsController < ApplicationController
  caches_action :show

   def show 
     @post = Post.find(params[:id])
   end
end

it works fine when I visit different post but when a post gets updated it does not reflect that

Thanks

zedtux commented 6 years ago

@mzaragoza you are right, the documentation of this gem is not complete. You have to use a so called Sweeper.

Have a look at the rails-observers README.

andreevmap commented 5 years ago

Можно обновлять так: expire_action controller: "posts", action: "show" Но данный метод не работает из другого контроллера! Может кто подскажет как его вызвать из другого контроллера?

andreevmap commented 5 years ago

@zedtux rails-observers is not working for rails 5.. end mongoid

vanboom commented 3 years ago

:+1: It would be nice to have a cache_key type of control over the expiration of the cache at the controller level.