Class: RDStationClient::AccessToken::Storage

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Singleton
Defined in:
lib/rd_station_client/access_token/storage.rb

Constant Summary collapse

LIB_PREFIX =
'rd_station_client'

Instance Method Summary collapse

Constructor Details

#initializeStorage

Returns a new instance of Storage.



13
14
15
16
17
# File 'lib/rd_station_client/access_token/storage.rb', line 13

def initialize
  @pool = ::ConnectionPool.new(size: config.redis.pool_size) do
    Redis.new(config.redis.connection_params)
  end
end

Instance Method Details

#find(key) ⇒ Object



19
20
21
# File 'lib/rd_station_client/access_token/storage.rb', line 19

def find(key)
  with { |connection| connection.get(key_path(key)) }
end

#persist(key, value) ⇒ Object



23
24
25
# File 'lib/rd_station_client/access_token/storage.rb', line 23

def persist(key, value)
  with { |connection| connection.set(key_path(key), value) }
end