Class: MemoizeUntil

Inherits:
Object
  • Object
show all
Defined in:
lib/memoize_until/base.rb,
lib/memoize_until/store.rb,
lib/memoize_until/railtie.rb,
lib/memoize_until/extensions.rb,
lib/memoize_until/time_patch.rb

Defined Under Namespace

Modules: TimePatch Classes: NotImplementedError, NullObject, Railtie, Store

Class Method Summary collapse

Class Method Details

.add_to(kind, key) ⇒ Object

Adds a purpose at runtime for the specified kind.

Examples:

Memoizing per day.

MemoizeUntil.add_to(:day, :runtime_key)

Parameters:

  • kind (Symbol)

    one of the default or customised kind supported

  • key (Symbol)

    the purpose defined in memoize_until.yml or :default.

Returns:

  • {}



44
45
46
# File 'lib/memoize_until/base.rb', line 44

def self.add_to(kind, key)
  TYPE_FACTORY[kind].add(key)
end

.clear_now_for(kind, key) ⇒ Object

clears previously memoized value for "now" for the given key only clears memory in the process that this code runs on. added for supporting custom scripts / test cases

Examples:

Clearing currently memoised value for today for :default.

MemoizeUntil.clear_for(:day, :default)

Parameters:

  • kind (Symbol)

    one of the default or customised kind supported

  • key (Symbol)

    the purpose defined in memoize_until.yml or :default.

Returns:

  • nil



59
60
61
# File 'lib/memoize_until/base.rb', line 59

def self.clear_now_for(kind, key)
  TYPE_FACTORY[kind].clear_now(key)
end