Package com.tangosol.net.cache
Class CacheLoaderCacheStore<K,V>
- java.lang.Object
-
- com.tangosol.util.Base
-
- com.tangosol.net.cache.AbstractCacheLoader<K,V>
-
- com.tangosol.net.cache.AbstractCacheStore<K,V>
-
- com.tangosol.net.cache.CacheLoaderCacheStore<K,V>
-
- All Implemented Interfaces:
CacheLoader<K,V>
,CacheStore<K,V>
- Direct Known Subclasses:
CacheLoaderCacheStore.Iterable
public class CacheLoaderCacheStore<K,V> extends AbstractCacheStore<K,V>
A read-only CacheStore that wraps a CacheLoader.- Since:
- Coherence 3.2
- Author:
- cp 2006.09.06
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CacheLoaderCacheStore.Iterable<K,V>
An extension to the CacheLoaderCacheStore that implements the IterableCacheLoader interface.-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Field Summary
Fields Modifier and Type Field Description protected CacheLoader<K,V>
m_loader
The CacheLoader to delegate to.
-
Constructor Summary
Constructors Constructor Description CacheLoaderCacheStore(CacheLoader<K,V> loader)
The CacheLoader to delegate to.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description V
load(K key)
Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.Map<K,V>
loadAll(Collection<? extends K> colKeys)
Return the values associated with each the specified keys in the passed collection.static <K,V>
CacheStore<K,V>wrapCacheLoader(CacheLoader<K,V> loader)
Create a CacheStore wrapper for the passed CacheLoader.-
Methods inherited from class com.tangosol.net.cache.AbstractCacheStore
erase, store
-
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.tangosol.net.cache.CacheStore
eraseAll, storeAll
-
-
-
-
Field Detail
-
m_loader
protected CacheLoader<K,V> m_loader
The CacheLoader to delegate to.
-
-
Constructor Detail
-
CacheLoaderCacheStore
public CacheLoaderCacheStore(CacheLoader<K,V> loader)
The CacheLoader to delegate to.- Parameters:
loader
- the delegate CacheLoader
-
-
Method Detail
-
wrapCacheLoader
public static <K,V> CacheStore<K,V> wrapCacheLoader(CacheLoader<K,V> loader)
Create a CacheStore wrapper for the passed CacheLoader. Note that the returned CacheStore will implement the IterableCacheLoader interface if and only if the passed CacheLoader implements it.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
loader
- the CacheLoader to wrap- Returns:
- a CacheStore
-
load
public V load(K key)
Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.- Specified by:
load
in interfaceCacheLoader<K,V>
- Specified by:
load
in classAbstractCacheLoader<K,V>
- Parameters:
key
- key whose associated value is to be returned- Returns:
- the value associated with the specified key, or null if no value is available for that key
-
loadAll
public Map<K,V> loadAll(Collection<? extends K> colKeys)
Return the values associated with each the specified keys in the passed collection. If a key does not have an associated value in the underlying store, then the return map will not have an entry for that key.The default implementation of this method calls
CacheLoader.load(K)
for each key in the supplied Collection. Implementations that can optimize multi-key operationsshould
override this default implementation.- Parameters:
colKeys
- a collection of keys to load- Returns:
- a Map of keys to associated values for the specified keys
-
-