Class: Headsail::Redis

Inherits:
Object
  • Object
show all
Defined in:
lib/headsail/redis.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key_name) ⇒ Redis

Returns a new instance of Redis.



7
8
9
10
11
# File 'lib/headsail/redis.rb', line 7

def initialize(key_name)
  @key_name = key_name
  setup_connection
  setup_task
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



5
6
7
# File 'lib/headsail/redis.rb', line 5

def connection
  @connection
end

Instance Method Details

#add(data) ⇒ Object



13
14
15
16
17
# File 'lib/headsail/redis.rb', line 13

def add(data)
  @connection.lpush(@key_name, data)
rescue
  setup_connection
end