Class: Qup::Adapter::Redis::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/qup/adapter/redis/connection.rb

Overview

Internal: The Common base class for Redis Topic and Queue

Direct Known Subclasses

Queue, Topic

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, name) ⇒ Connection

Public: Create a new Connection

uri - the connection uri for the Redis Client name - the String name of the Connection

Returns a new Connection.



16
17
18
19
20
# File 'lib/qup/adapter/redis/connection.rb', line 16

def initialize( uri, name )
  @uri    = uri
  @client = Redis.new :host => @uri.host, :port => @uri.port
  @name   = name
end

Instance Attribute Details

#nameObject (readonly)

Public: the name of the Queue or Topic



8
9
10
# File 'lib/qup/adapter/redis/connection.rb', line 8

def name
  @name
end

Instance Method Details

#destroyObject

Public: destroy the connection

Closes the redis client connection.

Returns nothing.



27
28
29
# File 'lib/qup/adapter/redis/connection.rb', line 27

def destroy
  @client.client.disconnect
end