Class: Twitchus::Storage

Inherits:
Object
  • Object
show all
Defined in:
lib/twitchus/storage.rb

Instance Method Summary collapse

Constructor Details

#initialize(host, port, key) ⇒ Storage

Returns a new instance of Storage.



7
8
9
10
# File 'lib/twitchus/storage.rb', line 7

def initialize(host, port, key)
  @client = Redis.new(host: host, port: port)
  @key = key
end

Instance Method Details

#clearObject



17
18
19
# File 'lib/twitchus/storage.rb', line 17

def clear
  @client.expire @key, -1
end

#push(item) ⇒ Object

Add an item to the list specified in config



13
14
15
# File 'lib/twitchus/storage.rb', line 13

def push(item)
  @client.lpush(@key, item) if item
end