public class EhcacheCache<V,T> extends Object implements Cache<V,T>
You can use the system property org.apache.archiva.ehcache.diskStore to set the default disk store path.
| Constructor and Description |
|---|
EhcacheCache() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear the cache of all entries.
|
void |
dispose() |
T |
get(V key)
Get the value of the specified key, if it exists in the cache.
|
Path |
getConfigurationFile()
Returns the path to the configuration file or
null, if not set. |
long |
getDiskExpiryThreadIntervalSeconds() |
String |
getDiskStorePath() |
long |
getMaxBytesLocalHeap() |
long |
getMaxBytesLocalOffHeap() |
int |
getMaxElementsInMemory() |
int |
getMaxElementsOnDisk() |
String |
getMemoryEvictionPolicy() |
net.sf.ehcache.store.MemoryStoreEvictionPolicy |
getMemoryStoreEvictionPolicy() |
String |
getName() |
CacheStatistics |
getStatistics()
Obtain a set of Statistics about the performance of the cache.
|
int |
getTimeToIdleSeconds() |
int |
getTimeToLiveSeconds() |
boolean |
hasKey(V key)
Tests to see if the provided key exists within the cache.
|
void |
initialize() |
boolean |
isDiskPersistent() |
boolean |
isEternal() |
boolean |
isFailOnDuplicateCache() |
boolean |
isOverflowToDisk()
Deprecated.
This flag is ignored. The persistence strategy is always overflow to disk, if on.
|
boolean |
isOverflowToOffHeap() |
boolean |
isStatisticsEnabled() |
T |
put(V key,
T value)
Put the specified value into the cache under the provided key.
|
void |
register(V key,
T value)
Register the specified value into the cache under the provided key.
|
T |
remove(V key)
Remove the specified key and value from the cache.
|
void |
setConfigurationFile(Path configurationFile)
Sets the path to the configuration file.
|
void |
setDiskExpiryThreadIntervalSeconds(long diskExpiryThreadIntervalSeconds) |
void |
setDiskPersistent(boolean diskPersistent) |
void |
setDiskStorePath(String diskStorePath) |
void |
setEternal(boolean eternal) |
void |
setFailOnDuplicateCache(boolean failOnDuplicateCache) |
void |
setMaxBytesLocalHeap(long maxBytesLocalHeap) |
void |
setMaxBytesLocalOffHeap(long maxBytesLocalOffHeap) |
void |
setMaxElementsInMemory(int maxElementsInMemory) |
void |
setMaxElementsOnDisk(int maxElementsOnDisk) |
void |
setMemoryEvictionPolicy(String memoryEvictionPolicy) |
void |
setName(String name) |
void |
setOverflowToDisk(boolean overflowToDisk)
Deprecated.
This flag is ignored. The persistence strategy is always overflow to disk, if on.
|
void |
setOverflowToOffHeap(boolean overflowToOffHeap) |
void |
setStatisticsEnabled(boolean statisticsEnabled) |
void |
setTimeToIdleSeconds(int timeToIdleSeconds) |
void |
setTimeToLiveSeconds(int timeToLiveSeconds) |
public EhcacheCache()
@PostConstruct public void initialize()
@PreDestroy public void dispose()
public T get(V key)
Cachepublic long getDiskExpiryThreadIntervalSeconds()
public String getDiskStorePath()
public int getMaxElementsInMemory()
getMaxElementsInMemory in interface Cache<V,T>public String getMemoryEvictionPolicy()
public net.sf.ehcache.store.MemoryStoreEvictionPolicy getMemoryStoreEvictionPolicy()
public CacheStatistics getStatistics()
CachegetStatistics in interface Cache<V,T>public int getTimeToIdleSeconds()
getTimeToIdleSeconds in interface Cache<V,T>public int getTimeToLiveSeconds()
getTimeToLiveSeconds in interface Cache<V,T>public boolean hasKey(V key)
CacheCache.get(Object) method on the same key might return null as the period of time
between the 2 request might have been long enough for the underlying Cache implementation
to remove the key.public boolean isDiskPersistent()
public boolean isEternal()
public boolean isOverflowToDisk()
public void register(V key, T value)
CacheCache.register(Object, Object) method is just an optimized version of the Cache.put(Object, Object)
method, but does not return the previous value contained with the specified key.public T put(V key, T value)
Cachepublic T remove(V key)
Cachepublic void setDiskExpiryThreadIntervalSeconds(long diskExpiryThreadIntervalSeconds)
public void setDiskPersistent(boolean diskPersistent)
public void setDiskStorePath(String diskStorePath)
public void setEternal(boolean eternal)
public void setMaxElementsInMemory(int maxElementsInMemory)
setMaxElementsInMemory in interface Cache<V,T>public void setMemoryEvictionPolicy(String memoryEvictionPolicy)
public void setOverflowToDisk(boolean overflowToDisk)
overflowToDisk - true, or falsepublic void setTimeToIdleSeconds(int timeToIdleSeconds)
setTimeToIdleSeconds in interface Cache<V,T>public void setTimeToLiveSeconds(int timeToLiveSeconds)
setTimeToLiveSeconds in interface Cache<V,T>public boolean isStatisticsEnabled()
public void setStatisticsEnabled(boolean statisticsEnabled)
public boolean isFailOnDuplicateCache()
public void setFailOnDuplicateCache(boolean failOnDuplicateCache)
public boolean isOverflowToOffHeap()
public void setOverflowToOffHeap(boolean overflowToOffHeap)
public long getMaxBytesLocalHeap()
public void setMaxBytesLocalHeap(long maxBytesLocalHeap)
public long getMaxBytesLocalOffHeap()
public void setMaxBytesLocalOffHeap(long maxBytesLocalOffHeap)
public int getMaxElementsOnDisk()
getMaxElementsOnDisk in interface Cache<V,T>public void setMaxElementsOnDisk(int maxElementsOnDisk)
setMaxElementsOnDisk in interface Cache<V,T>public void setConfigurationFile(Path configurationFile)
configurationFile - a valid path to a ehcache xml configuration filepublic Path getConfigurationFile()
null, if not set.nullCopyright © 2006–2019 The Apache Software Foundation. All rights reserved.