com.atlassian.cache.ehcache
Class DelegatingCache<K,V>

java.lang.Object
  extended by com.atlassian.cache.ehcache.DelegatingCache<K,V>
All Implemented Interfaces:
Cache<K,V>, ManagedCache

public class DelegatingCache<K,V>
extends java.lang.Object
implements Cache<K,V>, ManagedCache

A Cache that delegates to EhCache.

Since:
2.0

Constructor Summary
DelegatingCache(net.sf.ehcache.Ehcache delegate, java.lang.String name, boolean flushable)
           
 
Method Summary
 void clear()
          Clear the cache.
 boolean equals(java.lang.Object object)
           
 V get(K key)
          Retrieve an object from this cache.
 java.util.Collection<K> getKeys()
          Gets the keys of all objects currently stored in the cache.
 java.lang.String getName()
          The name of the cache, uniquely identifies this cache.
 int hashCode()
           
 boolean isFlushable()
          Returns true if this cache can be flushed.
 void put(K key, V value)
          Put an object into the cache.
 void remove(K key)
          Remove the object identified by the key from the cache.
 void removeAll()
          Remove all of the objects from this cache.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingCache

public DelegatingCache(net.sf.ehcache.Ehcache delegate,
                       java.lang.String name,
                       boolean flushable)
Method Detail

getName

public java.lang.String getName()
Description copied from interface: ManagedCache
The name of the cache, uniquely identifies this cache.

Specified by:
getName in interface ManagedCache
Returns:
the name of the cache.

getKeys

public java.util.Collection<K> getKeys()
Description copied from interface: Cache
Gets the keys of all objects currently stored in the cache. This will return the keys in a new collection.

Specified by:
getKeys in interface Cache<K,V>
Returns:
a collection of Objects keys.

put

public void put(K key,
                V value)
Description copied from interface: Cache
Put an object into the cache. If the specified key already exists within the cache, it will be replaced by the new object.

Specified by:
put in interface Cache<K,V>
Parameters:
key - uniquely identifying the object to be added into the cache.
value - to be cached.

get

public V get(K key)
Description copied from interface: Cache
Retrieve an object from this cache.

Specified by:
get in interface Cache<K,V>
Parameters:
key - uniquely identifying the object to be retrieved.
Returns:
the object from the cache, or null if the object is not found.

remove

public void remove(K key)
Description copied from interface: Cache
Remove the object identified by the key from the cache. If no object can be found associated with this key then no action is taken.

Specified by:
remove in interface Cache<K,V>
Parameters:
key - uniquely identifying the object to be removed.

removeAll

public void removeAll()
Description copied from interface: Cache
Remove all of the objects from this cache.

Specified by:
removeAll in interface Cache<K,V>

clear

public void clear()
Description copied from interface: ManagedCache
Clear the cache.

Specified by:
clear in interface ManagedCache

isFlushable

public boolean isFlushable()
Description copied from interface: ManagedCache
Returns true if this cache can be flushed. To support clustering and high availability as well as general good cache management, caches should allow the cache manager to flush them when required by the underlying application.

Specified by:
isFlushable in interface ManagedCache
Returns:
true if this cache can be flushed.

equals

public boolean equals(@Nullable
                      java.lang.Object object)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2013 Atlassian. All Rights Reserved.