Sha256: fe75811c6fb8914ce3c08f7e2586602a2a4bae297f427a6ef74489bd5c4ad18b
Contents?: true
Size: 684 Bytes
Versions: 1
Compression:
Stored size: 684 Bytes
Contents
# frozen_string_literal: true class CacherObserver < ActiveRecord::Observer observe Post, Question, Testimonial, XmlImport, Settings, Structure, SiteActivity, Feature, ExtraFeature, ContentStorage, PopularLanguage def after_create(_record) self.class.clear_cache end def after_update(_record) self.class.clear_cache end def after_destroy(_record) self.class.clear_cache end # Clear all avaiable cache class << self def clear_cache Rails.cache.clear FileUtils.rm_rf Dir[Rails.root.join('tmp', 'file_cache', 'pages', '**/*').to_s] FileUtils.rm_rf Dir[Rails.root.join('public', 'cache', '**/*').to_s] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
translation_cms-0.1.5 | app/observers/cacher_observer.rb |