Module: Memosa::API

Defined in:
lib/memosa.rb

Overview

This module provides a #memosa helper that can be used to manipulate the memoization cache directly.

Instance Method Summary collapse

Instance Method Details

#memosaMemosa::Cache

Used to manipulate the memoized cache directly

Examples:

class State
  extend Memosa
  include Memosa::API

  memoize def id
    SecureRandom.uuid
  end

  def reset!
    memosa.clear
  end
end

Returns:



128
129
130
# File 'lib/memosa.rb', line 128

def memosa
  ::Memosa::Cache.new(@_memosa_cache ||= {})
end