Class: Bunq::ThreadSafeSessionCache
- Inherits:
-
Object
- Object
- Bunq::ThreadSafeSessionCache
- Defined in:
- lib/bunq/client.rb
Overview
Constant Summary collapse
- CACHE_KEY =
'CURRENT_BUNQ_SESSION'
Instance Method Summary collapse
- #clear ⇒ Object
- #get(&block) ⇒ Object
-
#initialize ⇒ ThreadSafeSessionCache
constructor
A new instance of ThreadSafeSessionCache.
Constructor Details
#initialize ⇒ ThreadSafeSessionCache
Returns a new instance of ThreadSafeSessionCache.
94 95 96 |
# File 'lib/bunq/client.rb', line 94 def initialize clear end |
Instance Method Details
#clear ⇒ Object
102 103 104 |
# File 'lib/bunq/client.rb', line 102 def clear @cache = ThreadSafe::Cache.new end |
#get(&block) ⇒ Object
98 99 100 |
# File 'lib/bunq/client.rb', line 98 def get(&block) @cache.fetch_or_store(CACHE_KEY) { block.call if block_given? } end |