Class: SparkleFormation::Cache
- Inherits:
-
Object
- Object
- SparkleFormation::Cache
- Defined in:
- lib/sparkle_formation/utils.rb
Overview
Cache helper
Class Method Summary collapse
-
.[](k) ⇒ Object
Get value.
-
.[]=(k, v) ⇒ Object
Set value.
-
.init! ⇒ self
Initialize cache within thread.
Class Method Details
.[](k) ⇒ Object
Get value
108 109 110 111 |
# File 'lib/sparkle_formation/utils.rb', line 108 def [](k) init! Thread.current[:sparkle_cache][k] end |
.[]=(k, v) ⇒ Object
Set value
118 119 120 121 |
# File 'lib/sparkle_formation/utils.rb', line 118 def []=(k, v) init! Thread.current[:sparkle_cache][k] = v end |
.init! ⇒ self
Initialize cache within thread
126 127 128 129 130 131 |
# File 'lib/sparkle_formation/utils.rb', line 126 def init! unless Thread.current[:sparkle_cache] Thread.current[:sparkle_cache] = {} end self end |