Class: Capcoauth::OAuth::TTLCache
- Inherits:
-
Object
- Object
- Capcoauth::OAuth::TTLCache
- Defined in:
- lib/capcoauth/oauth/ttl_cache.rb
Class Method Summary collapse
- .key_for(access_token) ⇒ Object
- .remove(access_token) ⇒ Object
- .store ⇒ Object
- .update(access_token, user_id) ⇒ Object
- .user_id_for(access_token) ⇒ Object
Class Method Details
.key_for(access_token) ⇒ Object
17 18 19 |
# File 'lib/capcoauth/oauth/ttl_cache.rb', line 17 def self.key_for(access_token) "capcoauth_token:#{access_token}" end |
.remove(access_token) ⇒ Object
13 14 15 |
# File 'lib/capcoauth/oauth/ttl_cache.rb', line 13 def self.remove(access_token) store.delete(key_for(access_token)) end |
.store ⇒ Object
21 22 23 |
# File 'lib/capcoauth/oauth/ttl_cache.rb', line 21 def self.store Capcoauth.configuration.cache_store end |
.update(access_token, user_id) ⇒ Object
9 10 11 |
# File 'lib/capcoauth/oauth/ttl_cache.rb', line 9 def self.update(access_token, user_id) store.write(key_for(access_token), user_id, expires_in: Capcoauth.configuration.token_verify_ttl) end |
.user_id_for(access_token) ⇒ Object
5 6 7 |
# File 'lib/capcoauth/oauth/ttl_cache.rb', line 5 def self.user_id_for(access_token) store.fetch(key_for(access_token)) end |