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
# Clear caches of .racks and .installed.
# @private
def self.clear_cache
# Clear cache of .racks
def self.clear_racks_cache
@racks = nil
end
# Clear caches of .racks and .installed.
def self.clear_installed_formulae_cache
clear_racks_cache
@installed = nil
end

View File

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