module Garage::Strategy::AuthServer::Cache
Public Class Methods
default_ttl()
click to toggle source
# File lib/garage/strategy/auth_server.rb, line 40 def self.default_ttl Garage.configuration.ttl_for_access_token_cache end
with_cache(key) { || ... }
click to toggle source
# File lib/garage/strategy/auth_server.rb, line 29 def self.with_cache(key) return yield unless Garage.configuration.cache_acceess_token_validation? cached_token = Rails.cache.read(key) return cached_token if cached_token && !cached_token.expired? token = yield Rails.cache.write(key, token, expires_in: default_ttl) if token && token.accessible? token end