Class: WAMP::Engines::Redis
Constant Summary collapse
- DEFAULT_HOST =
'localhost'- DEFAULT_PORT =
6379- DEFAULT_DATABASE =
0- DEFAULT_GC =
60- LOCK_TIMEOUT =
120
Instance Attribute Summary collapse
-
#clients ⇒ Object
Returns the value of attribute clients.
-
#topics ⇒ Object
Returns the value of attribute topics.
Attributes inherited from Memory
Instance Method Summary collapse
- #create_event(client, topic_uri, payload, excluded, included) ⇒ Object
-
#initialize(options) ⇒ Redis
constructor
Creates a new instance of the Redis engine and sets up the connections to the Redis server.
Methods inherited from Memory
#all_clients, #create_client, #delete_client, #find_clients, #find_or_create_topic, #subscribe_client_to_topic, #unsubscribe_client_from_topic
Constructor Details
#initialize(options) ⇒ Redis
Creates a new instance of the Redis engine and sets up the connections to the Redis server
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/wamp/engines/redis.rb', line 17 def initialize() super @host = [:host] || DEFAULT_HOST @port = [:port] || DEFAULT_PORT @database = [:database] || DEFAULT_DATABASE @gc = [:gc] || DEFAULT_GC @password = [:password] @namespace = [:namespace] || '' @clients_ns = @namespace + ":clients" @topics_ns = @namespace + ":topics" @prefixes_ns = @namespace + ":prefixes" @events_ns = @namespace + ":events" @completed_events = [] @redis = ::Redis.new(host: @host, port: @port) @subscriber = ::Redis.new(host: @host, port: @port) if @password @redis.auth(@password) @subscriber.auth(@password) end @redis.select(@database) @subscriber.select(@database) redis_subscribe_to_events end |
Instance Attribute Details
#clients ⇒ Object
Returns the value of attribute clients.
7 8 9 |
# File 'lib/wamp/engines/redis.rb', line 7 def clients @clients end |
#topics ⇒ Object
Returns the value of attribute topics.
7 8 9 |
# File 'lib/wamp/engines/redis.rb', line 7 def topics @topics end |
Instance Method Details
#create_event(client, topic_uri, payload, excluded, included) ⇒ Object
48 49 50 |
# File 'lib/wamp/engines/redis.rb', line 48 def create_event(client, topic_uri, payload, excluded, included) redis_create_event(client.id, topic_uri, protocol, payload, excluded, included) end |