Sha256: 022c692c89ac5decb01073ffe172598f2cb5f6413f220da95518c10966ae725b
Contents?: true
Size: 813 Bytes
Versions: 3
Compression:
Stored size: 813 Bytes
Contents
module Wework module JsTicket class RedisStore < Store def initialize(agent) raise RedisNotConfigException if redis.nil? super end def jsapi_ticket super redis.hget(key, "ticket") 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.ticket.nil? expires_at = Time.now.to_i + result.expires_in.to_i - Wework.expired_shift_seconds redis.hmset( key, "ticket", result.ticket, "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/js_ticket/redis_store.rb |
wework-0.3.3 | lib/wework/js_ticket/redis_store.rb |
wework-0.3.2 | lib/wework/js_ticket/redis_store.rb |