Package com.facebook.buck.rules.keys
Class RuleKeyCacheRecycler<V>
- java.lang.Object
-
- com.facebook.buck.rules.keys.RuleKeyCacheRecycler<V>
-
public class RuleKeyCacheRecycler<V> extends Object
Class which encapsulates all effort to cache and reuse aRuleKeyCache
between builds.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RuleKeyCacheRecycler.SettingsAffectingCache
Any external settings which, if changed, will cause the entire cache to be invalidated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <V> RuleKeyCacheRecycler<V>
create(TrackableRuleKeyCache<V> ruleKeyCache)
static <V> RuleKeyCacheRecycler<V>
createAndRegister(com.google.common.eventbus.EventBus eventBus, TrackableRuleKeyCache<V> ruleKeyCache, com.google.common.collect.ImmutableSet<ProjectFilesystem> watchedFilesystems)
com.google.common.collect.ImmutableList<Map.Entry<BuildRule,V>>
getCachedBuildRules()
void
invalidatePath(ProjectFilesystem filesystem, Path path)
void
onFilesystemChange(WatchmanOverflowEvent event)
void
onFilesystemChange(WatchmanPathEvent event)
RuleKeyCacheScope<V>
withRecycledCache(BuckEventBus buckEventBus, RuleKeyCacheRecycler.SettingsAffectingCache currentSettings)
Provides access to aRuleKeyCache
via aRuleKeyCacheScope
.
-
-
-
Method Detail
-
createAndRegister
public static <V> RuleKeyCacheRecycler<V> createAndRegister(com.google.common.eventbus.EventBus eventBus, TrackableRuleKeyCache<V> ruleKeyCache, com.google.common.collect.ImmutableSet<ProjectFilesystem> watchedFilesystems)
- Parameters:
eventBus
-EventBus
which delivers watchman events.watchedFilesystems
- allProjectFilesystem
s which use watchman to receive events when files are changed.- Returns:
- a new
RuleKeyCacheRecycler
.
-
create
public static <V> RuleKeyCacheRecycler<V> create(TrackableRuleKeyCache<V> ruleKeyCache)
-
onFilesystemChange
public void onFilesystemChange(WatchmanPathEvent event)
-
invalidatePath
public void invalidatePath(ProjectFilesystem filesystem, Path path)
-
onFilesystemChange
public void onFilesystemChange(WatchmanOverflowEvent event)
-
withRecycledCache
public RuleKeyCacheScope<V> withRecycledCache(BuckEventBus buckEventBus, RuleKeyCacheRecycler.SettingsAffectingCache currentSettings)
Provides access to aRuleKeyCache
via aRuleKeyCacheScope
. TheRuleKeyCacheScope
must be used with a try-resource block and does logging and cache invalidation both before and after being used.- Returns:
- a
RuleKeyCacheScope
managing access to enclosedRuleKeyCache
.
-
-