Class: Kiyohime::Stores::RedisStore

Inherits:
Object
  • Object
show all
Defined in:
lib/kiyohime/stores/redis_store.rb

Overview

A rudimentary abstraction of the store which will advance over time no doubt

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri = nil) ⇒ RedisStore

Returns a new instance of RedisStore.



10
11
12
# File 'lib/kiyohime/stores/redis_store.rb', line 10

def initialize(uri = nil)
  @url = uri || ENV['REDIS_URL'] || ENV['REDISCLOUD_URL'] || 'redis://127.0.0.1:6379/0'
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



8
9
10
# File 'lib/kiyohime/stores/redis_store.rb', line 8

def url
  @url
end

Instance Method Details

#hiredisObject



18
19
20
# File 'lib/kiyohime/stores/redis_store.rb', line 18

def hiredis
  EM::Hiredis.connect(url).pubsub
end

#redisObject



14
15
16
# File 'lib/kiyohime/stores/redis_store.rb', line 14

def redis
  Redis.new(url: url)
end