Class: Twitchus::Storage
- Inherits:
-
Object
- Object
- Twitchus::Storage
- Defined in:
- lib/twitchus/storage.rb
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(host, port, key) ⇒ Storage
constructor
A new instance of Storage.
-
#push(item) ⇒ Object
Add an item to the list specified in config.
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
#clear ⇒ Object
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 |