Class: Redic
- Inherits:
-
Object
- Object
- Redic
- Defined in:
- lib/redic.rb,
lib/redic/client.rb,
lib/redic/connection.rb
Defined Under Namespace
Modules: Connection Classes: Client
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #call(*args) ⇒ Object
- #commit ⇒ Object
-
#initialize(url = "redis://127.0.0.1:6379", timeout = 10_000_000) ⇒ Redic
constructor
A new instance of Redic.
- #queue(*args) ⇒ Object
- #timeout ⇒ Object
Constructor Details
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/redic.rb', line 5 def client @client end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/redic.rb', line 4 def url @url end |
Instance Method Details
#call(*args) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/redic.rb', line 13 def call(*args) @client.connect do @client.write(args) @client.read end end |
#commit ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/redic.rb', line 24 def commit @client.connect do @queue.each do |args| @client.write(args) end @queue.map do @client.read end end ensure @queue.clear end |
#queue(*args) ⇒ Object
20 21 22 |
# File 'lib/redic.rb', line 20 def queue(*args) @queue << args end |
#timeout ⇒ Object
38 39 40 |
# File 'lib/redic.rb', line 38 def timeout @client.timeout end |