Module: Slanger::Redis
Instance Method Summary collapse
- #hdel(*arg) ⇒ Object
- #hgetall(*arg) ⇒ Object
- #hincrby(*arg) ⇒ Object
- #hset(*arg) ⇒ Object
- #new_connection ⇒ Object
- #publish(*arg) ⇒ Object
- #publish_event(method, *args) ⇒ Object
- #publisher ⇒ Object
- #regular_connection ⇒ Object
- #send_command(method, *arg) ⇒ Object
- #subscriber ⇒ Object
Instance Method Details
#hdel(*arg) ⇒ Object
33 34 35 |
# File 'lib/slanger/redis.rb', line 33 def hdel(*arg) send_command :hdel, *arg end |
#hgetall(*arg) ⇒ Object
37 38 39 |
# File 'lib/slanger/redis.rb', line 37 def hgetall(*arg) send_command :hgetall, *arg end |
#hincrby(*arg) ⇒ Object
25 26 27 |
# File 'lib/slanger/redis.rb', line 25 def hincrby(*arg) send_command :hincrby, *arg end |
#hset(*arg) ⇒ Object
29 30 31 |
# File 'lib/slanger/redis.rb', line 29 def hset(*arg) send_command :hset, *arg end |
#new_connection ⇒ Object
62 63 64 |
# File 'lib/slanger/redis.rb', line 62 def new_connection EM::Hiredis.connect Slanger::Config.redis_address end |
#publish(*arg) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/slanger/redis.rb', line 41 def publish(*arg) result = publish_event(:publish, *arg).errback { |e| p [:publisherror, "redis:#{Slanger::Config.redis_address}:#{e}"] } result end |
#publish_event(method, *args) ⇒ Object
48 49 50 |
# File 'lib/slanger/redis.rb', line 48 def publish_event(method, *args) publisher.send(method, *args) end |
#publisher ⇒ Object
17 18 19 |
# File 'lib/slanger/redis.rb', line 17 def publisher @publisher ||= new_connection end |
#regular_connection ⇒ Object
13 14 15 |
# File 'lib/slanger/redis.rb', line 13 def regular_connection @regular_connection ||= new_connection end |
#send_command(method, *arg) ⇒ Object
21 22 23 |
# File 'lib/slanger/redis.rb', line 21 def send_command(method, *arg) regular_connection.send(method, *arg) end |