Class: Cassette::Authentication::Cache
- Inherits:
-
Object
- Object
- Cassette::Authentication::Cache
- Includes:
- Cache
- Defined in:
- lib/cassette/authentication/cache.rb
Instance Method Summary collapse
- #clear_authentication_cache! ⇒ Object
- #fetch_authentication(ticket, service, options = {}, &block) ⇒ Object
-
#initialize(logger) ⇒ Cache
constructor
A new instance of Cache.
Methods included from Cache
#backend, backend=, #backend=, #fetch, #uses_key
Constructor Details
#initialize(logger) ⇒ Cache
Returns a new instance of Cache.
11 12 13 |
# File 'lib/cassette/authentication/cache.rb', line 11 def initialize(logger) self.logger = logger end |
Instance Method Details
#clear_authentication_cache! ⇒ Object
23 24 25 26 |
# File 'lib/cassette/authentication/cache.rb', line 23 def clear_authentication_cache! backend.delete_matched('Cassette::Authentication.validate_ticket*') backend.delete_matched("#{uses_key('Cassette::Authentication.validate_ticket')}*") end |
#fetch_authentication(ticket, service, options = {}, &block) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/cassette/authentication/cache.rb', line 15 def fetch_authentication(ticket, service, = {}, &block) = { expires_in: 5 * 60, max_uses: 5000, force: false }.merge() fetch("Cassette::Authentication.validate_ticket(#{ticket}, #{service})", ) do logger.info("Authentication for #{ticket}, #{service} is not cached") block.call end end |