Class CacheBuilderSpec
- java.lang.Object
- 
- com.google.common.cache.CacheBuilderSpec
 
- 
 @GwtIncompatible public final class CacheBuilderSpec extends java.lang.Object A specification of aCacheBuilderconfiguration.CacheBuilderSpecsupports parsing configuration off of a string, which makes it especially useful for command-line configuration of aCacheBuilder.The string syntax is a series of comma-separated keys or key-value pairs, each corresponding to a CacheBuildermethod.- concurrencyLevel=[integer]: sets- CacheBuilder.concurrencyLevel.
- initialCapacity=[integer]: sets- CacheBuilder.initialCapacity.
- maximumSize=[long]: sets- CacheBuilder.maximumSize.
- maximumWeight=[long]: sets- CacheBuilder.maximumWeight.
- expireAfterAccess=[duration]: sets- CacheBuilder.expireAfterAccess(java.time.Duration).
- expireAfterWrite=[duration]: sets- CacheBuilder.expireAfterWrite(java.time.Duration).
- refreshAfterWrite=[duration]: sets- CacheBuilder.refreshAfterWrite(java.time.Duration).
- weakKeys: sets- CacheBuilder.weakKeys().
- softValues: sets- CacheBuilder.softValues().
- weakValues: sets- CacheBuilder.weakValues().
- recordStats: sets- CacheBuilder.recordStats().
 The set of supported keys will grow as CacheBuilderevolves, but existing keys will never be removed.Durations are represented by an integer, followed by one of "d", "h", "m", or "s", representing days, hours, minutes, or seconds respectively. (There is currently no syntax to request expiration in milliseconds, microseconds, or nanoseconds.) Whitespace before and after commas and equal signs is ignored. Keys may not be repeated; it is also illegal to use the following pairs of keys in a single value: - maximumSizeand- maximumWeight
- softValuesand- weakValues
 CacheBuilderSpecdoes not support configuringCacheBuildermethods with non-value parameters. These must be configured in code.A new CacheBuildercan be instantiated from aCacheBuilderSpecusingCacheBuilder.from(CacheBuilderSpec)orCacheBuilder.from(String).- Since:
- 12.0
- Author:
- Adam Winer
 
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CacheBuilderSpecdisableCaching()Returns a CacheBuilderSpec that will prevent caching.booleanequals(java.lang.Object obj)inthashCode()static CacheBuilderSpecparse(java.lang.String cacheBuilderSpecification)Creates a CacheBuilderSpec from a string.java.lang.StringtoParsableString()Returns a string that can be used to parse an equivalentCacheBuilderSpec.java.lang.StringtoString()Returns a string representation for this CacheBuilderSpec instance.
 
- 
- 
- 
Method Detail- 
parsepublic static CacheBuilderSpec parse(java.lang.String cacheBuilderSpecification) Creates a CacheBuilderSpec from a string.- Parameters:
- cacheBuilderSpecification- the string form
 
 - 
disableCachingpublic static CacheBuilderSpec disableCaching() Returns a CacheBuilderSpec that will prevent caching.
 - 
toParsableStringpublic java.lang.String toParsableString() Returns a string that can be used to parse an equivalentCacheBuilderSpec. The order and form of this representation is not guaranteed, except that reparsing its output will produce aCacheBuilderSpecequal to this instance.
 - 
toStringpublic java.lang.String toString() Returns a string representation for this CacheBuilderSpec instance. The form of this representation is not guaranteed.- Overrides:
- toStringin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
equalspublic boolean equals(@CheckForNull java.lang.Object obj) - Overrides:
- equalsin class- java.lang.Object
 
 
- 
 
-