org.apache.http.impl.client.cache
Class CacheConfig

java.lang.Object
  extended by org.apache.http.impl.client.cache.CacheConfig

public class CacheConfig
extends Object

Java Beans-style configuration for a CachingHttpClient.


Field Summary
static boolean DEFAULT_HEURISTIC_CACHING_ENABLED
          Default setting for heuristic caching
static float DEFAULT_HEURISTIC_COEFFICIENT
          Default coefficient used to heuristically determine freshness lifetime from cache entry.
static long DEFAULT_HEURISTIC_LIFETIME
          Default lifetime to be assumed when we cannot calculate freshness heuristically
static int DEFAULT_MAX_CACHE_ENTRIES
          Default setting for the maximum number of cache entries that will be retained.
static int DEFAULT_MAX_OBJECT_SIZE_BYTES
          Default setting for the maximum object size that will be cached, in bytes.
static int DEFAULT_MAX_UPDATE_RETRIES
          Default setting for the number of retries on a failed cache update
 
Constructor Summary
CacheConfig()
           
 
Method Summary
 float getHeuristicCoefficient()
          Returns coefficient used in heuristic freshness caching
 long getHeuristicDefaultLifetime()
          Get the default lifetime to be used if heuristic freshness calculation is not possible
 int getMaxCacheEntries()
          Returns the maximum number of cache entries the cache will retain.
 int getMaxObjectSizeBytes()
          Returns the current maximum object size that will be cached.
 int getMaxUpdateRetries()
          Returns the number of times to retry a cache update on failure
 boolean isHeuristicCachingEnabled()
          Returns if heuristic freshness caching is in enabled
 boolean isSharedCache()
          Returns whether the cache will behave as a shared cache or not.
 void setHeuristicCachingEnabled(boolean heuristicCachingEnabled)
          Set if heuristic freshness caching is enabled
 void setHeuristicCoefficient(float heuristicCoefficient)
          Set coefficient to be used in heuristic freshness caching
 void setHeuristicDefaultLifetime(long heuristicDefaultLifetime)
          Set default lifetime to be used if heuristic freshness calculation is not possible
 void setMaxCacheEntries(int maxCacheEntries)
          Sets the maximum number of cache entries the cache will retain.
 void setMaxObjectSizeBytes(int maxObjectSizeBytes)
          Specifies the maximum object size that will be eligible for caching.
 void setMaxUpdateRetries(int maxUpdateRetries)
          Sets the number of times to retry a cache update on failure
 void setSharedCache(boolean isSharedCache)
          Sets whether the cache should behave as a shared cache or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_OBJECT_SIZE_BYTES

public static final int DEFAULT_MAX_OBJECT_SIZE_BYTES
Default setting for the maximum object size that will be cached, in bytes.

See Also:
Constant Field Values

DEFAULT_MAX_CACHE_ENTRIES

public static final int DEFAULT_MAX_CACHE_ENTRIES
Default setting for the maximum number of cache entries that will be retained.

See Also:
Constant Field Values

DEFAULT_MAX_UPDATE_RETRIES

public static final int DEFAULT_MAX_UPDATE_RETRIES
Default setting for the number of retries on a failed cache update

See Also:
Constant Field Values

DEFAULT_HEURISTIC_CACHING_ENABLED

public static final boolean DEFAULT_HEURISTIC_CACHING_ENABLED
Default setting for heuristic caching

See Also:
Constant Field Values

DEFAULT_HEURISTIC_COEFFICIENT

public static final float DEFAULT_HEURISTIC_COEFFICIENT
Default coefficient used to heuristically determine freshness lifetime from cache entry.

See Also:
Constant Field Values

DEFAULT_HEURISTIC_LIFETIME

public static final long DEFAULT_HEURISTIC_LIFETIME
Default lifetime to be assumed when we cannot calculate freshness heuristically

See Also:
Constant Field Values
Constructor Detail

CacheConfig

public CacheConfig()
Method Detail

getMaxObjectSizeBytes

public int getMaxObjectSizeBytes()
Returns the current maximum object size that will be cached.

Returns:
size in bytes

setMaxObjectSizeBytes

public void setMaxObjectSizeBytes(int maxObjectSizeBytes)
Specifies the maximum object size that will be eligible for caching.

Parameters:
maxObjectSizeBytes - size in bytes

isSharedCache

public boolean isSharedCache()
Returns whether the cache will behave as a shared cache or not.

Returns:
true for a shared cache, false for a non-shared (private) cache

setSharedCache

public void setSharedCache(boolean isSharedCache)
Sets whether the cache should behave as a shared cache or not.

Parameters:
isSharedCache - true to behave as a shared cache, false to behave as a non-shared (private) cache.

getMaxCacheEntries

public int getMaxCacheEntries()
Returns the maximum number of cache entries the cache will retain.


setMaxCacheEntries

public void setMaxCacheEntries(int maxCacheEntries)
Sets the maximum number of cache entries the cache will retain.


getMaxUpdateRetries

public int getMaxUpdateRetries()
Returns the number of times to retry a cache update on failure


setMaxUpdateRetries

public void setMaxUpdateRetries(int maxUpdateRetries)
Sets the number of times to retry a cache update on failure


isHeuristicCachingEnabled

public boolean isHeuristicCachingEnabled()
Returns if heuristic freshness caching is in enabled


setHeuristicCachingEnabled

public void setHeuristicCachingEnabled(boolean heuristicCachingEnabled)
Set if heuristic freshness caching is enabled


getHeuristicCoefficient

public float getHeuristicCoefficient()
Returns coefficient used in heuristic freshness caching


setHeuristicCoefficient

public void setHeuristicCoefficient(float heuristicCoefficient)
Set coefficient to be used in heuristic freshness caching


getHeuristicDefaultLifetime

public long getHeuristicDefaultLifetime()
Get the default lifetime to be used if heuristic freshness calculation is not possible


setHeuristicDefaultLifetime

public void setHeuristicDefaultLifetime(long heuristicDefaultLifetime)
Set default lifetime to be used if heuristic freshness calculation is not possible



Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.