|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.cache.LazyLoadingCache<D>
public class LazyLoadingCache<D>
This class allows us to set up a cache that is lazy-loaded in a thread-safe way.
The type D is the type of the cache Data. It should normally be an immutable data object.
Nested Class Summary | |
---|---|
static interface |
LazyLoadingCache.CacheLoader<D>
|
Constructor Summary | |
---|---|
LazyLoadingCache(LazyLoadingCache.CacheLoader<D> cacheLoader)
|
Method Summary | |
---|---|
D |
getData()
Gets the cache data object. |
void |
reload()
This method will load the latest cache data, and then replace the existing cache data. |
void |
reset()
This method will throw away any existing cache data, and leave the LazyLoadingCache uninitialised. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LazyLoadingCache(LazyLoadingCache.CacheLoader<D> cacheLoader)
Method Detail |
---|
public D getData()
Calling this method may cause the cache data to be loaded, if it has not been loaded yet.
public void reload()
Note that it leaves the old cache data intact while the load is occuring in order to allow readers to continue to work without blocking.
This method is synchronized in order to stop a possible race condition that could publish stale data.
reset()
public void reset()
reload()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |