Class: Cassette::Client::Cache
- Inherits:
-
Object
- Object
- Cassette::Client::Cache
show all
- Includes:
- Cassette::Cache
- Defined in:
- lib/cassette/client/cache.rb
Instance Method Summary
collapse
#backend, backend=, #backend=, #fetch, #uses_key
Constructor Details
#initialize(logger) ⇒ Cache
12
13
14
|
# File 'lib/cassette/client/cache.rb', line 12
def initialize(logger)
self.logger = logger
end
|
Instance Method Details
#clear_st_cache! ⇒ Object
39
40
41
|
# File 'lib/cassette/client/cache.rb', line 39
def clear_st_cache!
end
|
#clear_tgt_cache! ⇒ Object
34
35
36
37
|
# File 'lib/cassette/client/cache.rb', line 34
def clear_tgt_cache!
backend.delete('Cassette::Client.tgt')
backend.delete("#{uses_key('Cassette::Client.tgt')}")
end
|
#fetch_st(tgt, service, options = {}, &_block) ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'lib/cassette/client/cache.rb', line 24
def fetch_st(tgt, service, options = {}, &_block)
options = { max_uses: 2000, expires_in: 252, force: false }.merge(options)
hash = Digest::MD5.hexdigest(tgt)
fetch("Cassette::Client.st(#{hash}, #{service})", options) do
logger.info "ST for #{service} is not cached"
yield
end
end
|
#fetch_tgt(options = {}, &_block) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/cassette/client/cache.rb', line 16
def fetch_tgt(options = {}, &_block)
options = { expires_in: 4 * 3600, max_uses: 5000, force: false }.merge(options)
fetch('Cassette::Client.tgt', options) do
logger.info('TGT cache miss')
yield
end
end
|