Class: Downgrade::Block
- Inherits:
-
Object
- Object
- Downgrade::Block
- Defined in:
- lib/downgrade/block.rb
Instance Attribute Summary collapse
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Instance Method Summary collapse
- #cache ⇒ Object
- #cache_key ⇒ Object
-
#initialize(uuid) ⇒ Block
constructor
A new instance of Block.
Constructor Details
#initialize(uuid) ⇒ Block
Returns a new instance of Block.
4 5 6 |
# File 'lib/downgrade/block.rb', line 4 def initialize(uuid) @uuid = uuid end |
Instance Attribute Details
#uuid ⇒ Object
Returns the value of attribute uuid.
3 4 5 |
# File 'lib/downgrade/block.rb', line 3 def uuid @uuid end |
Instance Method Details
#cache ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/downgrade/block.rb', line 8 def cache if Downgrade.block_switch.is_on? Downgrade.cache_store.fetch(cache_key, expires_in: 10.minutes) do yield end else yield end end |
#cache_key ⇒ Object
18 19 20 |
# File 'lib/downgrade/block.rb', line 18 def cache_key "downgrade:block:#{uuid}" end |