public static class CacheConfig.Builder extends Object
Modifier and Type | Method and Description |
---|---|
CacheConfig |
build() |
CacheConfig.Builder |
setAllow303Caching(boolean allow303Caching)
Enables or disables 303 caching.
|
CacheConfig.Builder |
setAsynchronousWorkerIdleLifetimeSecs(int asynchronousWorkerIdleLifetimeSecs)
Sets the current maximum idle lifetime in seconds for a
background revalidation worker thread.
|
CacheConfig.Builder |
setAsynchronousWorkersCore(int asynchronousWorkersCore)
Sets the minimum number of threads to keep alive for background
revalidations due to the
stale-while-revalidate directive. |
CacheConfig.Builder |
setAsynchronousWorkersMax(int asynchronousWorkersMax)
Sets the maximum number of threads to allow for background
revalidations due to the
stale-while-revalidate directive. |
CacheConfig.Builder |
setHeuristicCachingEnabled(boolean heuristicCachingEnabled)
Enables or disables heuristic caching.
|
CacheConfig.Builder |
setHeuristicCoefficient(float heuristicCoefficient)
Sets coefficient to be used in heuristic freshness caching.
|
CacheConfig.Builder |
setHeuristicDefaultLifetime(long heuristicDefaultLifetime)
Sets default lifetime in seconds to be used if heuristic freshness
calculation is not possible.
|
CacheConfig.Builder |
setMaxCacheEntries(int maxCacheEntries)
Sets the maximum number of cache entries the cache will retain.
|
CacheConfig.Builder |
setMaxObjectSize(long maxObjectSize)
Specifies the maximum response body size that will be eligible for caching.
|
CacheConfig.Builder |
setMaxUpdateRetries(int maxUpdateRetries)
Sets the number of times to retry a cache update on failure
|
CacheConfig.Builder |
setNeverCacheHTTP10ResponsesWithQueryString(boolean neverCacheHTTP10ResponsesWithQuery)
Sets whether the cache should never cache HTTP 1.0 responses with a query string or not.
|
CacheConfig.Builder |
setRevalidationQueueSize(int revalidationQueueSize)
Sets the current maximum queue size for background revalidations.
|
CacheConfig.Builder |
setSharedCache(boolean isSharedCache)
Sets whether the cache should behave as a shared cache or not.
|
CacheConfig.Builder |
setWeakETagOnPutDeleteAllowed(boolean weakETagOnPutDeleteAllowed)
Allows or disallows weak etags to be used with PUT/DELETE If-Match requests.
|
public CacheConfig.Builder setMaxObjectSize(long maxObjectSize)
maxObjectSize
- size in bytespublic CacheConfig.Builder setMaxCacheEntries(int maxCacheEntries)
public CacheConfig.Builder setMaxUpdateRetries(int maxUpdateRetries)
public CacheConfig.Builder setAllow303Caching(boolean allow303Caching)
allow303Caching
- should be true
to
permit 303 caching, false
to disable it.public CacheConfig.Builder setWeakETagOnPutDeleteAllowed(boolean weakETagOnPutDeleteAllowed)
weakETagOnPutDeleteAllowed
- should be true
to
permit weak etags, false
to reject them.public CacheConfig.Builder setHeuristicCachingEnabled(boolean heuristicCachingEnabled)
heuristicCachingEnabled
- should be true
to
permit heuristic caching, false
to enable it.public CacheConfig.Builder setHeuristicCoefficient(float heuristicCoefficient)
Last-Modified
and Date
headers of a cached response during which the cached
response will be considered heuristically fresh.heuristicCoefficient
- should be between 0.0
and
1.0
.public CacheConfig.Builder setHeuristicDefaultLifetime(long heuristicDefaultLifetime)
Last-Modified
freshness calculation if it is
available.heuristicDefaultLifetime
- is the number of seconds to
consider a cache-eligible response fresh in the absence of other
information. Set this to 0
to disable this style of
heuristic caching.public CacheConfig.Builder setSharedCache(boolean isSharedCache)
isSharedCache
- true to behave as a shared cache, false to
behave as a non-shared (private) cache. To have the cache
behave like a browser cache, you want to set this to false
.public CacheConfig.Builder setAsynchronousWorkersMax(int asynchronousWorkersMax)
stale-while-revalidate
directive.asynchronousWorkersMax
- number of threads; a value of 0 disables background
revalidations.public CacheConfig.Builder setAsynchronousWorkersCore(int asynchronousWorkersCore)
stale-while-revalidate
directive.asynchronousWorkersCore
- should be greater than zero and less than or equal
to getAsynchronousWorkersMax()
public CacheConfig.Builder setAsynchronousWorkerIdleLifetimeSecs(int asynchronousWorkerIdleLifetimeSecs)
asynchronousWorkerIdleLifetimeSecs
- idle lifetime in secondspublic CacheConfig.Builder setRevalidationQueueSize(int revalidationQueueSize)
public CacheConfig.Builder setNeverCacheHTTP10ResponsesWithQueryString(boolean neverCacheHTTP10ResponsesWithQuery)
neverCacheHTTP10ResponsesWithQuery
- true to never cache responses with a query
string, false to cache if explicit cache headers are found. Set this to true
to better emulate IE, which also never caches responses, regardless of what caching
headers may be present.public CacheConfig build()
Copyright © 1999–2013 The Apache Software Foundation. All rights reserved.