Sha256: a1c73b49abe50ae1b284339de48852cbb3e3f2099f2a545eda23555d5e13dfe2

Contents?: true

Size: 423 Bytes

Versions: 17

Compression:

Stored size: 423 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
    end

    self.enabled ||= true
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
pages_core-3.12.7 lib/pages_core/cache_sweeper.rb
pages_core-3.12.6 lib/pages_core/cache_sweeper.rb
pages_core-3.12.5 lib/pages_core/cache_sweeper.rb
pages_core-3.12.4 lib/pages_core/cache_sweeper.rb
pages_core-3.12.3 lib/pages_core/cache_sweeper.rb
pages_core-3.12.2 lib/pages_core/cache_sweeper.rb
pages_core-3.12.1 lib/pages_core/cache_sweeper.rb
pages_core-3.12.0 lib/pages_core/cache_sweeper.rb
pages_core-3.11.3 lib/pages_core/cache_sweeper.rb
pages_core-3.11.2 lib/pages_core/cache_sweeper.rb
pages_core-3.11.1 lib/pages_core/cache_sweeper.rb
pages_core-3.11.0 lib/pages_core/cache_sweeper.rb
pages_core-3.10.2 lib/pages_core/cache_sweeper.rb
pages_core-3.10.1 lib/pages_core/cache_sweeper.rb
pages_core-3.9.2 lib/pages_core/cache_sweeper.rb
pages_core-3.9.1 lib/pages_core/cache_sweeper.rb
pages_core-3.9.0 lib/pages_core/cache_sweeper.rb