Sha256: 0c4d919aef0f51a884f58893bcd78036bf054f90acf96bb82b37c89d3d045591

Contents?: true

Size: 407 Bytes

Versions: 7

Compression:

Stored size: 407 Bytes

Contents

# frozen_string_literal: true

module PagesCore
  class CacheSweeper
    class << self
      attr_accessor :enabled

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

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

    self.enabled ||= true
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pages_core-3.15.5 lib/pages_core/cache_sweeper.rb
pages_core-3.15.4 lib/pages_core/cache_sweeper.rb
pages_core-3.15.3 lib/pages_core/cache_sweeper.rb
pages_core-3.15.2 lib/pages_core/cache_sweeper.rb
pages_core-3.15.1 lib/pages_core/cache_sweeper.rb
pages_core-3.14.0 lib/pages_core/cache_sweeper.rb
pages_core-3.13.0 lib/pages_core/cache_sweeper.rb