class Bunq::ThreadSafeSessionCache

A thread-safe session cache that can hold one (the current) session.

Usage:

Bunq.configure do |config|

config.session_cache = Bunq::ThreadSafeSessionCache.new

end

After this, all Bunq.client calls will use the same session. When the session times out, a new one is started automatically.

Constants

CACHE_KEY

Public Class Methods

new() click to toggle source
# File lib/bunq/client.rb, line 94
def initialize
  clear
end

Public Instance Methods

clear() click to toggle source
# File lib/bunq/client.rb, line 102
def clear
  @cache = ThreadSafe::Cache.new
end
get(&block) click to toggle source
# File lib/bunq/client.rb, line 98
def get(&block)
  @cache.fetch_or_store(CACHE_KEY) { block.call if block_given? }
end