Package com.facebook.buck.rules.keys
Class TrackedRuleKeyCache<V>
- java.lang.Object
-
- com.facebook.buck.rules.keys.TrackedRuleKeyCache<V>
-
- Type Parameters:
V
-
- All Implemented Interfaces:
RuleKeyCache<V>
public class TrackedRuleKeyCache<V> extends Object implements RuleKeyCache<V>
A DefaultRuleKeyCache that records cache stats information in the corresponding CacheStatsTracker
-
-
Constructor Summary
Constructors Constructor Description TrackedRuleKeyCache(TrackableRuleKeyCache<V> cache, CacheStatsTracker statsTracker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description V
get(BuildEngineAction action)
V
get(BuildEngineAction action, java.util.function.Function<? super BuildEngineAction,RuleKeyResult<V>> create)
V
get(AddsToRuleKey appendable, java.util.function.Function<? super AddsToRuleKey,RuleKeyResult<V>> create)
CacheStats
getStats()
void
invalidateAll()
Invalidate everything in the cache.void
invalidateAllExceptFilesystems(com.google.common.collect.ImmutableSet<ProjectFilesystem> filesystems)
Invalidate all inputs *not* from the givenProjectFilesystem
s and their transitive dependents.void
invalidateFilesystem(ProjectFilesystem filesystem)
Invalidate all inputs from a givenProjectFilesystem
and their transitive dependents.void
invalidateInputs(Iterable<com.facebook.buck.rules.keys.RuleKeyInput> inputs)
Invalidate the given inputs and all their transitive dependents.
-
-
-
Constructor Detail
-
TrackedRuleKeyCache
public TrackedRuleKeyCache(TrackableRuleKeyCache<V> cache, CacheStatsTracker statsTracker)
-
-
Method Detail
-
get
@Nullable public V get(BuildEngineAction action)
- Specified by:
get
in interfaceRuleKeyCache<V>
- Returns:
- the rule key value for the given
action
, or null if it is not cached..
-
get
public V get(BuildEngineAction action, java.util.function.Function<? super BuildEngineAction,RuleKeyResult<V>> create)
- Specified by:
get
in interfaceRuleKeyCache<V>
- Returns:
- the rule key value for the given
rule
, either serving it form cache or by running the given function.
-
get
public V get(AddsToRuleKey appendable, java.util.function.Function<? super AddsToRuleKey,RuleKeyResult<V>> create)
- Specified by:
get
in interfaceRuleKeyCache<V>
- Returns:
- the rule key value for the given
appendable
, either serving it form cache or by running the given function.
-
invalidateInputs
public void invalidateInputs(Iterable<com.facebook.buck.rules.keys.RuleKeyInput> inputs)
Description copied from interface:RuleKeyCache
Invalidate the given inputs and all their transitive dependents.- Specified by:
invalidateInputs
in interfaceRuleKeyCache<V>
-
invalidateAllExceptFilesystems
public void invalidateAllExceptFilesystems(com.google.common.collect.ImmutableSet<ProjectFilesystem> filesystems)
Invalidate all inputs *not* from the givenProjectFilesystem
s and their transitive dependents.- Specified by:
invalidateAllExceptFilesystems
in interfaceRuleKeyCache<V>
-
invalidateFilesystem
public void invalidateFilesystem(ProjectFilesystem filesystem)
Invalidate all inputs from a givenProjectFilesystem
and their transitive dependents.- Specified by:
invalidateFilesystem
in interfaceRuleKeyCache<V>
-
invalidateAll
public void invalidateAll()
Invalidate everything in the cache.- Specified by:
invalidateAll
in interfaceRuleKeyCache<V>
-
getStats
public CacheStats getStats()
- Returns:
- the stats of the cache
-
-