lib/redic.rb in redic-0.0.8 vs lib/redic.rb in redic-1.0.0
- old
+ new
@@ -1,14 +1,14 @@
-require "redic/client"
+require_relative "redic/client"
class Redic
attr :url
attr :client
- def initialize(url = "redis://127.0.0.1:6379")
+ def initialize(url = "redis://127.0.0.1:6379", timeout: 10_000_000)
@url = url
- @client = Redic::Client.new(url)
+ @client = Redic::Client.new(url, timeout)
@queue = []
end
def call(*args)
@client.connect do
@@ -31,7 +31,11 @@
@client.read
end
end
ensure
@queue.clear
+ end
+
+ def timeout
+ @client.timeout
end
end