Module: Bootscale::ActiveSupport::CacheConcern

Included in:
Cache, DevelopmentCache
Defined in:
lib/bootscale/active_support.rb

Instance Method Summary collapse

Instance Method Details

#load_pathObject



21
22
23
# File 'lib/bootscale/active_support.rb', line 21

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



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/bootscale/active_support.rb', line 29

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