com.atlassian.confluence.cache
Class ThreadLocalCacheAccessor<K,V>

java.lang.Object
  extended by com.atlassian.confluence.cache.ThreadLocalCacheAccessor<K,V>

public class ThreadLocalCacheAccessor<K,V>
extends java.lang.Object

A type-safe way of accessing the threadlocal cache

See Also:
ThreadLocalCache

Method Summary
 V get(K key)
          Retrieve a value from the threadlocal cache
static
<K,V> ThreadLocalCacheAccessor<K,V>
newInstance()
          Factory method (for type inference)
 void put(K key, V value)
          Put a value in the threadlocal cache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newInstance

public static <K,V> ThreadLocalCacheAccessor<K,V> newInstance()
Factory method (for type inference)

Returns:
an appropriately parameterised cache accessor

put

public void put(K key,
                V value)
Put a value in the threadlocal cache

Parameters:
key - the key to cache
value - the value to cache

get

public V get(K key)
Retrieve a value from the threadlocal cache

Parameters:
key - the key for the cache value
Returns:
the appropriate value, or null if nothing was cached for that key, or the cache has not been initialised


Copyright © 2003-2010 Atlassian. All Rights Reserved.