public class

EhcacheCache

extends Object
implements Cache<V, T>
java.lang.Object
   ↳ org.apache.archiva.redback.components.cache.ehcache.EhcacheCache<V, T>

Class Overview

EhcacheCache configuration document available EhcacheUserGuide

Summary

Public Constructors
EhcacheCache()
Public Methods
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.
long getDiskExpiryThreadIntervalSeconds()
String getDiskStorePath()
long getMaxBytesLocalHeap()
long getMaxBytesLocalOffHeap()
int getMaxElementsInMemory()
int getMaxElementsOnDisk()
String getMemoryEvictionPolicy()
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()
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 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)
void setOverflowToOffHeap(boolean overflowToOffHeap)
void setStatisticsEnabled(boolean statisticsEnabled)
void setTimeToIdleSeconds(int timeToIdleSeconds)
void setTimeToLiveSeconds(int timeToLiveSeconds)
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.archiva.redback.components.cache.Cache

Public Constructors

public EhcacheCache ()

Public Methods

public void clear ()

Clear the cache of all entries.

public void dispose ()

public T get (V key)

Get the value of the specified key, if it exists in the cache.

Parameters
key the key to fetch the contents of.
Returns
  • the value of the key, or null if not found.

public long getDiskExpiryThreadIntervalSeconds ()

public String getDiskStorePath ()

public long getMaxBytesLocalHeap ()

public long getMaxBytesLocalOffHeap ()

public int getMaxElementsInMemory ()

public int getMaxElementsOnDisk ()

public String getMemoryEvictionPolicy ()

public MemoryStoreEvictionPolicy getMemoryStoreEvictionPolicy ()

public String getName ()

public CacheStatistics getStatistics ()

Obtain a set of Statistics about the performance of the cache.

Returns
  • the cache statistics.

public int getTimeToIdleSeconds ()

public int getTimeToLiveSeconds ()

public boolean hasKey (V key)

Tests to see if the provided key exists within the cache.

NOTE: Due to synchronization issues, if this method returns true, a subsequent request to the 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.

Parameters
key the key to test.
Returns
  • true if the key exists.

public void initialize ()

public boolean isDiskPersistent ()

public boolean isEternal ()

public boolean isFailOnDuplicateCache ()

public boolean isOverflowToDisk ()

public boolean isOverflowToOffHeap ()

public boolean isStatisticsEnabled ()

public T put (V key, T value)

Put the specified value into the cache under the provided key.

Parameters
key the key to put the value into
value the object to place into the cache.
Returns
  • the previous value for the key, or null if the key contained no value.

public void register (V key, T value)

Register the specified value into the cache under the provided key.

This register(Object, Object) method is just an optimized version of the put(Object, Object) method, but does not return the previous value contained with the specified key.

Parameters
key the key to put the value into
value the object to place into the cache.

public T remove (V key)

Remove the specified key and value from the cache.

Parameters
key the key to the value to remove.
Returns
  • the value of the key that was removed.

public void setDiskExpiryThreadIntervalSeconds (long diskExpiryThreadIntervalSeconds)

public void setDiskPersistent (boolean diskPersistent)

public void setDiskStorePath (String diskStorePath)

public void setEternal (boolean eternal)

public void setFailOnDuplicateCache (boolean failOnDuplicateCache)

public void setMaxBytesLocalHeap (long maxBytesLocalHeap)

public void setMaxBytesLocalOffHeap (long maxBytesLocalOffHeap)

public void setMaxElementsInMemory (int maxElementsInMemory)

public void setMaxElementsOnDisk (int maxElementsOnDisk)

public void setMemoryEvictionPolicy (String memoryEvictionPolicy)

public void setName (String name)

public void setOverflowToDisk (boolean overflowToDisk)

public void setOverflowToOffHeap (boolean overflowToOffHeap)

public void setStatisticsEnabled (boolean statisticsEnabled)

public void setTimeToIdleSeconds (int timeToIdleSeconds)

public void setTimeToLiveSeconds (int timeToLiveSeconds)