Module: ROM::Cache

Defined in:
lib/rom/support/cache.rb

Defined Under Namespace

Modules: Methods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object



5
6
7
8
9
# File 'lib/rom/support/cache.rb', line 5

def self.extended(klass)
  super
  klass.include(Methods)
  klass.instance_variable_set(:@__cache__, Concurrent::Map.new)
end

Instance Method Details

#cacheObject



11
12
13
# File 'lib/rom/support/cache.rb', line 11

def cache
  @__cache__
end

#fetch_or_store(*args, &block) ⇒ Object



15
16
17
# File 'lib/rom/support/cache.rb', line 15

def fetch_or_store(*args, &block)
  cache.fetch_or_store(args.hash, &block)
end