Sha256: 048e12e84aaa8c8c758d6fcaed6651196f7f2520adb7ab6cf199fb49da53cc29
Contents?: true
Size: 834 Bytes
Versions: 3
Compression:
Stored size: 834 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 unless result.access_token.nil? expires_at = Time.now.to_i + result.expires_in.to_i - Wework.expired_shift_seconds 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
wework-0.3.4 | lib/wework/token/redis_store.rb |
wework-0.3.3 | lib/wework/token/redis_store.rb |
wework-0.3.2 | lib/wework/token/redis_store.rb |