Class: Redrecord
- Inherits:
-
Object
- Object
- Redrecord
- Defined in:
- lib/redrecord.rb
Defined Under Namespace
Modules: Model
Class Attribute Summary collapse
-
.enabled ⇒ Object
Returns the value of attribute enabled.
-
.redis ⇒ Object
Returns the value of attribute redis.
-
.timeout ⇒ Object
Returns the value of attribute timeout.
-
.write_only ⇒ Object
Returns the value of attribute write_only.
Class Method Summary collapse
Class Attribute Details
.enabled ⇒ Object
Returns the value of attribute enabled.
7 8 9 |
# File 'lib/redrecord.rb', line 7 def enabled @enabled end |
.redis ⇒ Object
Returns the value of attribute redis.
7 8 9 |
# File 'lib/redrecord.rb', line 7 def redis @redis end |
.timeout ⇒ Object
Returns the value of attribute timeout.
7 8 9 |
# File 'lib/redrecord.rb', line 7 def timeout @timeout end |
.write_only ⇒ Object
Returns the value of attribute write_only.
7 8 9 |
# File 'lib/redrecord.rb', line 7 def write_only @write_only end |
Class Method Details
.is_marshalled?(str) ⇒ Boolean
11 12 13 |
# File 'lib/redrecord.rb', line 11 def is_marshalled?(str) Marshal.dump(nil)[0,2] == str[0,2] end |
.redis_op(op, *args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/redrecord.rb', line 14 def redis_op(op, *args) if @enabled begin Timeout.timeout(@timeout || 15) do redis.send(op, *args) end rescue Exception => e STDERR.puts "Redrecord: Disabling redis due to exception (#{e})" @enabled = false end end end |
.update_queue ⇒ Object
8 9 10 |
# File 'lib/redrecord.rb', line 8 def update_queue Thread.current[:redrecord_update_queue] ||= [] end |