Merge pull request #17602 from rrotter/desc_search_cache
clear description cache if updated w/o EVAL_ALL
This commit is contained in:
commit
f9ea8faab1
@ -68,6 +68,14 @@ class CacheStoreDatabase
|
||||
db.delete(key)
|
||||
end
|
||||
|
||||
# Deletes all content from the underlying database (if it already exists).
|
||||
def clear!
|
||||
return unless created?
|
||||
|
||||
dirty!
|
||||
db.clear
|
||||
end
|
||||
|
||||
# Closes the underlying database (if it is created and open).
|
||||
def write_if_dirty!
|
||||
return unless dirty?
|
||||
|
||||
@ -41,7 +41,10 @@ class DescriptionCacheStore < CacheStore
|
||||
# @param report [Report] an update report generated by cmd/update.rb
|
||||
# @return [nil]
|
||||
def update_from_report!(report)
|
||||
return unless Homebrew::EnvConfig.eval_all?
|
||||
unless Homebrew::EnvConfig.eval_all?
|
||||
database.clear!
|
||||
return
|
||||
end
|
||||
return populate_if_empty! if database.empty?
|
||||
return if report.empty?
|
||||
|
||||
@ -60,7 +63,10 @@ class DescriptionCacheStore < CacheStore
|
||||
# @param formula_names [Array] the formulae to update
|
||||
# @return [nil]
|
||||
def update_from_formula_names!(formula_names)
|
||||
return unless Homebrew::EnvConfig.eval_all?
|
||||
unless Homebrew::EnvConfig.eval_all?
|
||||
database.clear!
|
||||
return
|
||||
end
|
||||
return populate_if_empty! if database.empty?
|
||||
|
||||
formula_names.each do |name|
|
||||
@ -108,7 +114,10 @@ class CaskDescriptionCacheStore < DescriptionCacheStore
|
||||
# @param report [Report] an update report generated by cmd/update.rb
|
||||
# @return [nil]
|
||||
def update_from_report!(report)
|
||||
return unless Homebrew::EnvConfig.eval_all?
|
||||
unless Homebrew::EnvConfig.eval_all?
|
||||
database.clear!
|
||||
return
|
||||
end
|
||||
return populate_if_empty! if database.empty?
|
||||
return if report.empty?
|
||||
|
||||
@ -124,7 +133,10 @@ class CaskDescriptionCacheStore < DescriptionCacheStore
|
||||
# @param cask_tokens [Array] the casks to update
|
||||
# @return [nil]
|
||||
def update_from_cask_tokens!(cask_tokens)
|
||||
return unless Homebrew::EnvConfig.eval_all?
|
||||
unless Homebrew::EnvConfig.eval_all?
|
||||
database.clear!
|
||||
return
|
||||
end
|
||||
return populate_if_empty! if database.empty?
|
||||
|
||||
cask_tokens.each do |token|
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user