Sha256: 572b6c4e184dd4685dbfefc235491b0963d8bbf9cd04ec0c4acf5f76ed53d1ae

Contents?: true

Size: 683 Bytes

Versions: 5

Compression:

Stored size: 683 Bytes

Contents

# frozen_string_literal: true

module PagesCore
  class CacheSweeper
    class << self
      attr_accessor :enabled

      def disable(&_block)
        old_value = enabled
        self.enabled = false
        yield if block_given?
        self.enabled = old_value
      end

      def once(&block)
        disable(&block)
        PagesCore::StaticCache.handler.sweep!
      end

      def config
        ActiveSupport::Deprecation.warn(
          "PagesCore::CacheSweeper.config is no longer used."
        )
        configuration = OpenStruct.new(patterns: [])
        yield configuration if block_given?
        configuration
      end
    end

    self.enabled ||= true
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pages_core-3.8.3 lib/pages_core/cache_sweeper.rb
pages_core-3.8.2 lib/pages_core/cache_sweeper.rb
pages_core-3.8.1 lib/pages_core/cache_sweeper.rb
pages_core-3.8.0 lib/pages_core/cache_sweeper.rb
pages_core-3.7.0 lib/pages_core/cache_sweeper.rb