Sha256: 70ef6fff014fd7b0bd191ec3a085c67a34bcab6e039b301dd154e3378bc9a2b1
Contents?: true
Size: 691 Bytes
Versions: 2
Compression:
Stored size: 691 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, "jsapi_ticket") end def expired? redis.hvals(key).empty? end def refresh_token result = super expires_at = Time.now.to_i + result['expires_in'].to_i - 100 redis.hmset( key, "jsapi_ticket", result['ticket'], "expires_at", expires_at ) redis.expireat(key, expires_at) end private def redis Wework.redis end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wework-0.1.4 | lib/wework/js_ticket/redis_store.rb |
wework-0.1.3 | lib/wework/js_ticket/redis_store.rb |