It contains the CacheLoader
and
CacheWriter
interfaces that
allow loading from and writing to other systems respectively.
A cache with a registered loader can be configured as a read-through cache, so that access will automatically load missing entries. And similarly a cache with a registered writer can be configured as a write-through cache, so that changes are written through to an underlying system.
In addition a common idiom is to use a loader to initially
populate or refresh a cache. For that purpose there is the
Cache.loadAll(java.util.Set, boolean, CompletionListener)
method.
Interface | Description |
---|---|
CacheLoader<K,V> |
Used when a cache is read-through or when loading data into a cache via the
Cache.loadAll(java.util.Set, boolean,
CompletionListener) method. |
CacheWriter<K,V> |
A CacheWriter is used for write-through to an external resource.
|
CompletionListener |
A CompletionListener is implemented by an application when it needs to be
notified of the completion of some Cache operation.
|
Class | Description |
---|---|
CompletionListenerFuture |
A CompletionListenerFuture is a CompletionListener implementation that
supports being used as a Future.
|
Exception | Description |
---|---|
CacheLoaderException |
An exception to indicate a problem has occurred executing a
CacheLoader . |
CacheWriterException |
An exception to indicate a problem has occurred executing a
CacheWriter . |
Copyright © 2017. All rights reserved.