Sha256: 5b118cbc5926743102b21add9ef26130883071373c9f9477fa50bb2577b4644c

Contents?: true

Size: 421 Bytes

Versions: 3

Compression:

Stored size: 421 Bytes

Contents

# encoding: utf-8

module PagesCore
  module Sweepable
    extend ActiveSupport::Concern

    included do
      after_save :sweep_cache!
      after_destroy :sweep_cache!
    end

    attr_accessor :cache_swept

    protected

    def sweep_cache!
      return unless PagesCore::CacheSweeper.enabled
      return if cache_swept
      PagesCore::SweepCacheJob.perform_later
      self.cache_swept = true
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pages_core-3.4.3 app/models/concerns/pages_core/sweepable.rb
pages_core-3.5.1 app/models/concerns/pages_core/sweepable.rb
pages_core-3.4.2 app/models/concerns/pages_core/sweepable.rb