module Dry::Core::Cache
def self.extended(klass)
- Api: - private
def self.extended(klass) super klass.include(Methods) klass.instance_variable_set(:@__cache__, ::Concurrent::Map.new) end
def cache
- Api: - private
def cache @__cache__ end
def fetch_or_store(*args, &)
-
(Object)
- block's return value (cached for subsequent calls with
Other tags:
- Note: - beware Proc instance hashes are not equal, i.e. -> { 1 }.hash != -> { 1 }.hash,
Other tags:
- Yield: - An arbitrary block
Parameters:
-
args
(Array
) -- List of hashable objects
def fetch_or_store(*args, &) cache.fetch_or_store(args.hash, &) end
def inherited(klass)
- Api: - private
def inherited(klass) super klass.instance_variable_set(:@__cache__, cache) end