Class: OAuth2c::Cache::Manager
- Inherits:
-
Object
- Object
- OAuth2c::Cache::Manager
show all
- Extended by:
- Forwardable
- Defined in:
- lib/oauth2c/cache/manager.rb
Defined Under Namespace
Classes: CacheProxy
Instance Method Summary
collapse
Constructor Details
#initialize(client, cache_backend) ⇒ Manager
Returns a new instance of Manager.
31
32
33
34
|
# File 'lib/oauth2c/cache/manager.rb', line 31
def initialize(client, cache_backend)
@client = client
@cache = Cache::Store.new(cache_backend)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, key, *args, **opts) ⇒ Object
44
45
46
47
|
# File 'lib/oauth2c/cache/manager.rb', line 44
def method_missing(name, key, *args, **opts)
grant = @client.public_send(name, *args, **opts)
CacheProxy.new(@cache, key, grant)
end
|
Instance Method Details
#cached(key, scope: @client.default_scope) ⇒ Object
40
41
42
|
# File 'lib/oauth2c/cache/manager.rb', line 40
def cached(key, scope: @client.default_scope)
@cache.cached(key, scope: scope)
end
|
#cached?(key, scope: @client.default_scope) ⇒ Boolean
36
37
38
|
# File 'lib/oauth2c/cache/manager.rb', line 36
def cached?(key, scope: @client.default_scope)
@cache.cached?(key, scope: scope)
end
|
#respond_to_missing?(name, include_private = false) ⇒ Boolean
49
50
51
|
# File 'lib/oauth2c/cache/manager.rb', line 49
def respond_to_missing?(name, include_private = false)
@client.respond_to?(name) || super
end
|