Sha256: 638d05e922e4cf0eedc87488ebd15d43d7b5e5e79610498c0640438ee5b02823
Contents?: true
Size: 796 Bytes
Versions: 1
Compression:
Stored size: 796 Bytes
Contents
module Wework module Token class RedisStore < Store def initialize(agent) raise RedisNotConfigException if redis.nil? super end def access_token super redis.hget(key, "access_token") end def expired? redis.hvals(key).empty? || redis.hget(key, "expires_at").to_i <= Time.now.to_i end def refresh_token result = super if result.success? expires_at = Time.now.to_i + result.expires_in.to_i - 100 redis.hmset( key, "access_token", result.access_token, "expires_at", expires_at ) redis.expireat(key, expires_at) end end private def redis Wework.redis end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wework-0.2.6 | lib/wework/token/redis_store.rb |