com.atlassian.confluence.cache.ehcache
Class ConfluenceEhCache<K,V>

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

public class ConfluenceEhCache<K,V>
extends java.lang.Object
implements ConfigurableCache<K,V>

Confluence-specific wrapper around a standard atlassian-cache implementation. Adds support for value wrappers to aid EhCAche sizeof diagnostics, plus support for the ConfigurableCache interface


Constructor Summary
ConfluenceEhCache(com.atlassian.cache.Cache<K,V> atlassianCacheDelegate, net.sf.ehcache.config.CacheConfiguration ehCacheConfig)
           
 
Method Summary
 boolean containsKey(K k)
           
 V get(K key)
           
 java.util.Collection<K> getKeys()
           
 java.lang.String getName()
           
 void put(K key, V value)
           
 V putIfAbsent(K key, V value)
           
 void remove(K key)
           
 boolean remove(K key, V value)
           
 void removeAll()
           
 boolean replace(K key, V oldValue, V newValue)
           
 void setTimeToLive(long timeToLive, java.util.concurrent.TimeUnit timeUnit)
          Update the time to live.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfluenceEhCache

public ConfluenceEhCache(com.atlassian.cache.Cache<K,V> atlassianCacheDelegate,
                         net.sf.ehcache.config.CacheConfiguration ehCacheConfig)
Method Detail

get

public V get(K key)
Specified by:
get in interface com.atlassian.cache.Cache<K,V>

containsKey

public boolean containsKey(@NotNull
                           K k)
Specified by:
containsKey in interface com.atlassian.cache.Cache<K,V>

getKeys

public java.util.Collection<K> getKeys()
Specified by:
getKeys in interface com.atlassian.cache.Cache<K,V>

getName

public java.lang.String getName()
Specified by:
getName in interface com.atlassian.cache.Cache<K,V>

put

public void put(K key,
                V value)
Specified by:
put in interface com.atlassian.cache.Cache<K,V>

remove

public void remove(K key)
Specified by:
remove in interface com.atlassian.cache.Cache<K,V>

removeAll

public void removeAll()
Specified by:
removeAll in interface com.atlassian.cache.Cache<K,V>

setTimeToLive

public void setTimeToLive(long timeToLive,
                          java.util.concurrent.TimeUnit timeUnit)
Description copied from interface: ConfigurableCache
Update the time to live. Please note, some implementations cannot store time values smaller than TimeUnit.SECONDS.

Specified by:
setTimeToLive in interface ConfigurableCache<K,V>
Parameters:
timeToLive - value
timeUnit - unit of time

putIfAbsent

public V putIfAbsent(K key,
                     V value)
Specified by:
putIfAbsent in interface com.atlassian.cache.Cache<K,V>

replace

public boolean replace(K key,
                       V oldValue,
                       V newValue)
Specified by:
replace in interface com.atlassian.cache.Cache<K,V>

remove

public boolean remove(K key,
                      V value)
Specified by:
remove in interface com.atlassian.cache.Cache<K,V>


Copyright © 2003-2014 Atlassian. All Rights Reserved.