|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.atlassian.confluence.cache.ThreadLocalCache
public class ThreadLocalCache
A generic cache for "stuff" that is only needed for the lifetime of a web request or scheduled job. The most important rule for this cache is use custom types for keys. If you use some generic key type like a String, you will inevitably clobber someone else's cached data.
Don't use the ThreadLocalCache directly: use the ThreadLocalCacheAccessor to give you a typesafe container around the cache.
ThreadLocalCacheAccessor
Constructor Summary | |
---|---|
ThreadLocalCache()
|
Method Summary | |
---|---|
static void |
dispose()
Clean up the cache for the current thread. |
static void |
flush()
Flush the contents of the cache, but do not clean up the cache itself. |
static java.lang.Object |
get(java.lang.Object key)
Retrieve an object from the cache |
static void |
init()
Initialise the cache for the current thread |
static void |
put(java.lang.Object key,
java.lang.Object value)
Put an object in the cache |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ThreadLocalCache()
Method Detail |
---|
public static void put(java.lang.Object key, java.lang.Object value)
key
- the cache keyvalue
- the value to cachepublic static java.lang.Object get(java.lang.Object key)
key
- the cache key
public static void init()
public static void dispose()
public static void flush()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |