Class: Bootscale::ActiveSupport::Cache

Inherits:
Cache
  • Object
show all
Defined in:
lib/bootscale/active_support.rb

Instance Method Summary collapse

Methods inherited from Cache

#[], #initialize

Constructor Details

This class inherits a constructor from Bootscale::Cache

Instance Method Details

#load_pathObject



4
5
6
# File 'lib/bootscale/active_support.rb', line 4

def load_path
  ::ActiveSupport::Dependencies.autoload_paths
end

#reload(force = true) ⇒ Object

Ideally we’d use a more accurate comparison like #hash, unfortunately it’s not efficient enough given how much of a hot spot this is. So we assume entries are not mutated or replaced, only added or removed. It is obviously wrong sometimes, and you’ll have to manually call Bootscale.regenerate



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/bootscale/active_support.rb', line 12

def reload(force = true)
  @load_path_size ||= nil

  if force
    @cache = fetch(load_path)
    @load_path_size = load_path.size
  elsif (size = load_path.size) != @load_path_size
    @cache = fetch(load_path)
    @load_path_size = size
  end
end