Class: Bugloco::Cache
- Inherits:
-
Object
- Object
- Bugloco::Cache
- Defined in:
- lib/bugloco/cache.rb
Constant Summary collapse
- NAMESPACE =
"bugloco"
Class Method Summary collapse
Class Method Details
.get(key) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/bugloco/cache.rb', line 10 def get(key) value = Thread.current[NAMESPACE][key] rescue nil if block_given? yield value else return value end end |
.reset! ⇒ Object
6 7 8 |
# File 'lib/bugloco/cache.rb', line 6 def reset! Thread.current[NAMESPACE] = {} end |
.set(key, value) ⇒ Object
20 21 22 |
# File 'lib/bugloco/cache.rb', line 20 def set(key, value) Thread.current[NAMESPACE][key] = value end |