formula: make cache clearing methods, *ahem*, clearer

This commit is contained in:
Alyssa Ross 2016-11-17 14:34:04 +00:00
parent 5baf16f50e
commit 3555206a7f
2 changed files with 8 additions and 4 deletions

View File

@ -1337,10 +1337,14 @@ class Formula
end end
end end
# Clear caches of .racks and .installed. # Clear cache of .racks
# @private def self.clear_racks_cache
def self.clear_cache
@racks = nil @racks = nil
end
# Clear caches of .racks and .installed.
def self.clear_installed_formulae_cache
clear_racks_cache
@installed = nil @installed = nil
end end

View File

@ -319,7 +319,7 @@ class Tab < OpenStruct
def write def write
# If this is a new installation, the cache of installed formulae # If this is a new installation, the cache of installed formulae
# will no longer be valid. # will no longer be valid.
Formula.clear_cache unless tabfile.exist? Formula.clear_installed_formulae_cache unless tabfile.exist?
CACHE[tabfile] = self CACHE[tabfile] = self
tabfile.atomic_write(to_json) tabfile.atomic_write(to_json)