Class: PagesCore::CacheSweeper

Inherits:
Object
  • Object
show all
Defined in:
lib/pages_core/cache_sweeper.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.enabledObject

Returns the value of attribute enabled.



6
7
8
# File 'lib/pages_core/cache_sweeper.rb', line 6

def enabled
  @enabled
end

Class Method Details

.disable(&_block) ⇒ Object



8
9
10
11
12
13
# File 'lib/pages_core/cache_sweeper.rb', line 8

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

.once(&block) ⇒ Object



15
16
17
18
# File 'lib/pages_core/cache_sweeper.rb', line 15

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