Class: ShuntCache::Status
- Inherits:
-
Object
- Object
- ShuntCache::Status
- Extended by:
- Forwardable
- Includes:
- Singleton
- Defined in:
- lib/shunt_cache/status.rb
Constant Summary collapse
- SHUNTED =
"shunted"- UNSHUNTED =
"ok"
Instance Attribute Summary collapse
-
#cache ⇒ Object
Returns the value of attribute cache.
-
#key ⇒ Object
Returns the value of attribute key.
-
#logger ⇒ Object
Returns the value of attribute logger.
Class Method Summary collapse
Instance Method Summary collapse
-
#clear! ⇒ Object
reset to default.
- #shunt! ⇒ Object
- #shunted? ⇒ Boolean
- #status ⇒ Object
- #unshunt! ⇒ Object
Instance Attribute Details
#cache ⇒ Object
Returns the value of attribute cache.
11 12 13 |
# File 'lib/shunt_cache/status.rb', line 11 def cache @cache end |
#key ⇒ Object
Returns the value of attribute key.
11 12 13 |
# File 'lib/shunt_cache/status.rb', line 11 def key @key end |
#logger ⇒ Object
Returns the value of attribute logger.
11 12 13 |
# File 'lib/shunt_cache/status.rb', line 11 def logger @logger end |
Class Method Details
.configure {|instance| ... } ⇒ Object
16 17 18 |
# File 'lib/shunt_cache/status.rb', line 16 def self.configure yield instance end |
Instance Method Details
#clear! ⇒ Object
reset to default
31 32 33 |
# File 'lib/shunt_cache/status.rb', line 31 def clear! cache.delete(key) end |
#shunt! ⇒ Object
35 36 37 38 |
# File 'lib/shunt_cache/status.rb', line 35 def shunt! log(:info, "Shunting site with key: #{key}") cache.write(key, SHUNTED) end |
#shunted? ⇒ Boolean
26 27 28 |
# File 'lib/shunt_cache/status.rb', line 26 def shunted? status == SHUNTED end |
#status ⇒ Object
20 21 22 23 24 |
# File 'lib/shunt_cache/status.rb', line 20 def status cache.fetch(key) do UNSHUNTED end end |
#unshunt! ⇒ Object
40 41 42 43 |
# File 'lib/shunt_cache/status.rb', line 40 def unshunt! log(:info, "Unshunting site with key: #{key}") cache.write(key, UNSHUNTED) end |