Class: WeixinAuthorize::JsTicket::RedisStore
- Inherits:
-
Store
- Object
- Store
- WeixinAuthorize::JsTicket::RedisStore
show all
- Defined in:
- lib/weixin_authorize/js_ticket/redis_store.rb
Constant Summary
collapse
- JSTICKET =
"jsticket"
- EXPIRED_AT =
"expired_at"
Instance Attribute Summary
Attributes inherited from Store
#client
Instance Method Summary
collapse
Methods inherited from Store
init_with, #initialize, #set_jsticket
Instance Method Details
#jsticket ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/weixin_authorize/js_ticket/redis_store.rb', line 26
def jsticket
super
client.jsticket = weixin_redis.hget(client.jsticket_redis_key, JSTICKET)
client.jsticket_expired_at = weixin_redis.hget(
client.jsticket_redis_key,
EXPIRED_AT
)
client.jsticket
end
|
#jsticket_expired? ⇒ Boolean
7
8
9
|
# File 'lib/weixin_authorize/js_ticket/redis_store.rb', line 7
def jsticket_expired?
weixin_redis.hvals(client.jsticket_redis_key).empty?
end
|
#refresh_jsticket ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/weixin_authorize/js_ticket/redis_store.rb', line 11
def refresh_jsticket
super
weixin_redis.hmset(
client.jsticket_redis_key,
JSTICKET,
client.jsticket,
EXPIRED_AT,
client.jsticket_expired_at
)
weixin_redis.expireat(
client.jsticket_redis_key,
client.jsticket_expired_at.to_i
)
end
|