2014-10-07 30 views

回答

0

ActiveRecord有一組回調(more info)。
我會使用after_commit回調來使您的緩存失效。

class MyClass < ActiveRecord::Base 
    after_commit :invalidate_cache 

    private 
    def invalidate_cache 
     #some logic 
    end 
end