class Google::Auth::Stores::RedisTokenStore

‘g-user-token:`
are stored as JSON using the supplied key, prefixed with
Implementation of user token storage backed by Redis. Tokens

def delete id

(see Google::Auth::Stores::TokenStore#delete)
def delete id
  key = key_for id
  @redis.del key
end

def initialize options = {}

Other tags:
    Note: - If no redis instance is provided, a new one is created and

Parameters:
  • prefix (String) --
  • redis (::Redis, String) --
def initialize options = {}
  super()
  redis = options.delete :redis
  prefix = options.delete :prefix
  @redis = case redis
           when Redis
             redis
           else
             Redis.new options
           end
  @prefix = prefix || DEFAULT_KEY_PREFIX
end

def key_for id

Returns:
  • (String) -

Parameters:
  • id (String) --
def key_for id
  @prefix + id
end

def load id

(see Google::Auth::Stores::TokenStore#load)
def load id
  key = key_for id
  @redis.get key
end

def store id, token

(see Google::Auth::Stores::TokenStore#store)
def store id, token
  key = key_for id
  @redis.set key, token
end