Module: Mrcr::Cache::Methods

Defined in:
lib/mrcr/cache.rb

Overview

Instance methods

Instance Method Summary collapse

Instance Method Details

#fetch(key, default = nil) { ... } ⇒ Object

Delegates call to the class-level method

Parameters:

  • key (Object)

    Hashable object

  • default (Object) (defaults to: nil)

    Default value.

Yields:

  • An arbitrary block

Returns:

  • (Object)

    block’s return value



87
88
89
# File 'lib/mrcr/cache.rb', line 87

def fetch(key, default = nil)
  self.class.fetch(key, default)
end

#fetch_or_store(key) { ... } ⇒ Object

Delegates call to the class-level method

Parameters:

  • key (Array<Object>)

    Hashable object

Yields:

  • An arbitrary block

Returns:

  • (Object)

    block’s return value



76
77
78
# File 'lib/mrcr/cache.rb', line 76

def fetch_or_store(key, &block)
  self.class.fetch_or_store(key, &block)
end