Class: Ellen::Brains::Redis
- Inherits:
-
Base
- Object
- Base
- Ellen::Brains::Redis
- Defined in:
- lib/ellen/brains/redis.rb
Constant Summary collapse
- NAMESPACE =
"ellen"- KEY =
"brain"
Instance Attribute Summary collapse
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize ⇒ Redis
constructor
A new instance of Redis.
- #save ⇒ Object
Constructor Details
#initialize ⇒ Redis
Returns a new instance of Redis.
17 18 19 20 |
# File 'lib/ellen/brains/redis.rb', line 17 def initialize super @thread = Thread.new { sync } end |
Instance Attribute Details
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
12 13 14 |
# File 'lib/ellen/brains/redis.rb', line 12 def thread @thread end |
Instance Method Details
#data ⇒ Object
22 23 24 |
# File 'lib/ellen/brains/redis.rb', line 22 def data @data ||= pull || {} end |
#save ⇒ Object
26 27 28 |
# File 'lib/ellen/brains/redis.rb', line 26 def save push end |