Module: Slanger::Redis
Instance Method Summary collapse
- #channel_attend(*arg) ⇒ Object
- #channel_leave(*arg) ⇒ Object
- #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
#channel_attend(*arg) ⇒ Object
41 42 43 |
# File 'lib/slanger/redis.rb', line 41 def channel_attend(*arg) send_command :channel_attend, *arg end |
#channel_leave(*arg) ⇒ Object
37 38 39 |
# File 'lib/slanger/redis.rb', line 37 def channel_leave(*arg) send_command :channel_leave, *arg end |
#hdel(*arg) ⇒ Object
33 34 35 |
# File 'lib/slanger/redis.rb', line 33 def hdel(*arg) send_command :hdel, *arg end |
#hgetall(*arg) ⇒ Object
45 46 47 |
# File 'lib/slanger/redis.rb', line 45 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
67 68 69 |
# File 'lib/slanger/redis.rb', line 67 def new_connection EM::Hiredis.connect Slanger::Config.redis_address end |
#publish(*arg) ⇒ Object
49 50 51 |
# File 'lib/slanger/redis.rb', line 49 def publish(*arg) publish_event(:publish, *arg) end |
#publish_event(method, *args) ⇒ Object
53 54 55 |
# File 'lib/slanger/redis.rb', line 53 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 |