Class: FootStats::RedisPayloadStore

Inherits:
Object
  • Object
show all
Defined in:
lib/foot_stats/redis_payload_store.rb

Instance Method Summary collapse

Constructor Details

#initialize(redis_config) ⇒ RedisPayloadStore

Returns a new instance of RedisPayloadStore.



3
4
5
# File 'lib/foot_stats/redis_payload_store.rb', line 3

def initialize(redis_config)
  @redis = setup_redis(redis_config)
end

Instance Method Details

#[](key) ⇒ Object



7
8
9
# File 'lib/foot_stats/redis_payload_store.rb', line 7

def [](key)
  @redis[key]
end

#[]=(key, value) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/foot_stats/redis_payload_store.rb', line 11

def []=(key, value)
  @redis[key] = value
  if key.to_s.match(/^match_narration/) || key.to_s.match(/^live_match/) || key.to_s.match(/^match_championship/)
    @redis.expire key, 1.month
  end
  value
end