Class: OpenWeatherClient::Caching::Redis

Inherits:
OpenWeatherClient::Caching show all
Defined in:
lib/open_weather_client-caching-redis/caching/redis.rb,
lib/open_weather_client-caching-redis/caching/redis/version.rb

Overview

Redis cache of OpenWeatherMap requests

The requests are cached in redis with an expiration time set by the configuration

Constant Summary collapse

VERSION =
'0.1.2'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRedis

Returns a new instance of Redis.



17
18
19
20
21
22
# File 'lib/open_weather_client-caching-redis/caching/redis.rb', line 17

def initialize
  super

  config = OpenWeatherClient.configuration
  @redis = ::Redis.new(host: config.host, port: config.port, db: config.db)
end

Instance Attribute Details

#redisObject (readonly)

Returns the value of attribute redis.



15
16
17
# File 'lib/open_weather_client-caching-redis/caching/redis.rb', line 15

def redis
  @redis
end