public abstract class GridNearCacheAdapter<K,V> extends GridDistributedCacheAdapter<K,V>
GridDistributedCacheAdapter.GlobalRemoveAllJob<K,V>GridCacheAdapter.AsyncOp<T>, GridCacheAdapter.BulkOperation, GridCacheAdapter.CacheExpiryPolicy, GridCacheAdapter.FutureHolder, GridCacheAdapter.InvokeAllTimeStatClosure<T>, GridCacheAdapter.PeekModes, GridCacheAdapter.TopologyVersionAwareJob, GridCacheAdapter.UpdateGetTimeStatClosure<T>, GridCacheAdapter.UpdatePutAndGetTimeStatClosure<T>, GridCacheAdapter.UpdatePutTimeStatClosure<T>, GridCacheAdapter.UpdateRemoveTimeStatClosure<T>, GridCacheAdapter.UpdateTimeStatClosure<T>cacheCfg, CLEAR_ALL_SPLIT_THRESHOLD, ctx, DFLT_CACHE_RETRIES_COUNT, DFLT_CACHE_START_SIZE, DFLT_START_CACHE_SIZE, lastFut, locNodeId, log, map, MAX_RETRIES, metrics, RET2NULL, txLockMsgLog| Modifier | Constructor and Description |
|---|---|
protected |
GridNearCacheAdapter()
Empty constructor required for
Externalizable. |
protected |
GridNearCacheAdapter(GridCacheContext<K,V> ctx) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
clearLocally(K key)
Clears an entry from this cache and swap storage only if the entry
is not currently locked, and is not participating in a transaction.
|
void |
clearLocallyAll(Set<? extends K> keys,
boolean srv,
boolean near,
boolean readers)
Clears entries from this cache and swap storage only if the entry
is not currently locked, and is not participating in a transaction.
|
abstract GridDhtCacheAdapter<K,V> |
dht() |
GridCacheMapEntry |
entryEx(KeyCacheObject key,
AffinityTopologyVersion topVer) |
GridNearCacheEntry |
entryExx(KeyCacheObject key,
AffinityTopologyVersion topVer) |
Set<javax.cache.Cache.Entry<K,V>> |
entrySet(CacheEntryPredicate... filter) |
boolean |
evict(K key)
Evicts entry associated with given key from cache.
|
void |
evictAll(Collection<? extends K> keys)
Attempts to evict all entries associated with keys.
|
boolean |
isAllLockedNearOnly(Iterable<? extends K> keys) |
boolean |
isLocked(K key)
Checks if any node owns a lock for this key.
|
boolean |
isLockedNearOnly(K key) |
boolean |
isNear() |
IgniteInternalFuture<Map<K,V>> |
loadAsync(@Nullable IgniteInternalTx tx,
@Nullable Collection<KeyCacheObject> keys,
boolean forcePrimary,
@Nullable UUID subjId,
String taskName,
boolean deserializeBinary,
boolean recovery,
@Nullable javax.cache.expiry.ExpiryPolicy expiryPlc,
boolean skipVal,
boolean skipStore,
boolean needVer) |
void |
localLoad(Collection<? extends K> keys,
javax.cache.expiry.ExpiryPolicy plc,
boolean keepBinary) |
void |
localLoadCache(IgniteBiPredicate<K,V> p,
Object[] args)
Delegates to
CacheStore.loadCache(IgniteBiInClosure, Object...) method
to load state from the underlying persistent storage. |
IgniteInternalFuture<?> |
localLoadCacheAsync(IgniteBiPredicate<K,V> p,
Object[] args)
Asynchronously delegates to
CacheStore.loadCache(IgniteBiInClosure, Object...) method
to reload state from the underlying persistent storage. |
Set<javax.cache.Cache.Entry<K,V>> |
nearEntries() |
int |
nearSize()
Gets size of near cache key set.
|
long |
offHeapAllocatedSize()
Gets memory size allocated in off-heap.
|
long |
offHeapEntriesCount()
Gets number of cache entries stored in off-heap memory.
|
void |
onReconnected() |
@Nullable GridNearCacheEntry |
peekExx(KeyCacheObject key) |
GridCachePreloader |
preloader() |
int |
primarySize()
Gets the number of all primary entries cached on this node.
|
long |
primarySizeLong()
Gets the number of all primary entries cached on this node as a long value.
|
protected void |
processGetResponse(UUID nodeId,
GridNearGetResponse res) |
int |
size()
Gets the number of all entries cached on this node.
|
long |
sizeLong()
Gets the number of all entries cached on this node as a long value.
|
List<GridCacheClearAllRunnable<K,V>> |
splitClearLocally(boolean srv,
boolean near,
boolean readers)
Split clearLocally all task into multiple runnables.
|
void |
start()
Starts this cache.
|
String |
toString() |
localSizeLong, localSizeLong, lockAllAsync, lockAllAsync, removeAll, removeAllAsync, removeVersionedEntry, txLockAsyncactive, active, affinity, allEntries, asyncOp, asyncOpAcquire, asyncOpRelease, awaitLastFut, cache, checkCurrentTx, checkJta, clear, clear, clearAll, clearAllAsync, clearAsync, clearAsync, clearLocally, clearLocally, clusterMetrics, clusterMetrics, clusterMxBean, configuration, containsKey, containsKeyAsync, containsKeys, containsKeysAsync, context, decrementSize, entries, entryEx, entryEx, entrySet, expiry, expiryPolicy, forSubjectId, get, get, getAll, getAll, getAllAsync, getAllAsync, getAllAsync, getAllAsync0, getAllOutTx, getAllOutTxAsync, getAndPut, getAndPut, getAndPut0, getAndPutAsync, getAndPutAsync, getAndPutAsync0, getAndPutIfAbsent, getAndPutIfAbsentAsync, getAndRemove, getAndRemove0, getAndRemoveAsync, getAndRemoveAsync0, getAndReplace, getAndReplaceAsync, getAsync, getAsync, getEntries, getEntriesAsync, getEntry, getEntryAsync, getForcePrimary, getForcePrimaryAsync, igniteIterator, igniteIterator, incrementSize, init, invoke, invoke, invokeAll, invokeAll, invokeAllAsync, invokeAllAsync, invokeAsync, isColocated, isDht, isDhtAtomic, isEmpty, isLocal, isLockedByThread, iterator, iterator, keepBinary, keySet, loadAll, localEntries, localMetrics, localMxBean, localPeek, localPreloadPartition, localSize, lock, lockAll, lockAsync, log, lostPartitions, map, metrics0, name, nextVersion, nextVersion, onDeferredDelete, onKernalStart, onKernalStop, onUndeploy, parsePeekModes, peekEx, peekEx, preloadPartition, preloadPartitionAsync, printMemoryStats, put, put, put0, putAll, putAll0, putAllAsync, putAllAsync0, putAllConflict, putAllConflictAsync, putAsync, putAsync, putAsync0, putIfAbsent, putIfAbsentAsync, readExternal, readResolve, rebalance, remove, remove, remove, remove0, removeAll, removeAll0, removeAllAsync, removeAllAsync0, removeAllConflict, removeAllConflictAsync, removeAsync, removeAsync, removeAsync, removeAsync0, removeEntry, removeIfObsolete, removeMetrics, repairableGet, repairableGetAll, repairableGetAllAsync, repairableGetAsync, repairAsync, repairAsync, replace, replace, replaceAsync, replaceAsync, saveFuture, scanIterator, setSkipStore, size, sizeAsync, sizeLong, sizeLong, sizeLongAsync, sizeLongAsync, skipStore, startInfo, stop, stopInfo, tx, txStart, txStart, txStartEx, unlock, warnIfUnordered, warnIfUnordered, withAllowAtomicOpsInTx, withExpiryPolicy, withNoRetries, writeExternalclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitunlockAllforEach, spliteratorprotected GridNearCacheAdapter()
Externalizable.protected GridNearCacheAdapter(GridCacheContext<K,V> ctx)
ctx - Context.public void start()
throws IgniteCheckedException
start in class GridCacheAdapter<K,V>IgniteCheckedException - If start failed.public abstract GridDhtCacheAdapter<K,V> dht()
public void onReconnected()
onReconnected in class GridCacheAdapter<K,V>public boolean isNear()
isNear in class GridCacheAdapter<K,V>True if this is near cache.public GridCachePreloader preloader()
preloader in class GridCacheAdapter<K,V>public GridCacheMapEntry entryEx(KeyCacheObject key, AffinityTopologyVersion topVer)
entryEx in class GridCacheAdapter<K,V>key - Entry key.topVer - Topology version.null).public GridNearCacheEntry entryExx(KeyCacheObject key, AffinityTopologyVersion topVer)
key - Key.topVer - Topology version.@Nullable public @Nullable GridNearCacheEntry peekExx(KeyCacheObject key)
key - Key.public boolean isLocked(K key)
This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.
isLocked in interface IgniteInternalCache<K,V>isLocked in class GridCacheAdapter<K,V>key - Key to check.True if lock is owned by some node.public boolean isLockedNearOnly(K key)
key - Key.public boolean isAllLockedNearOnly(Iterable<? extends K> keys)
keys - Keys.public IgniteInternalFuture<Map<K,V>> loadAsync(@Nullable @Nullable IgniteInternalTx tx, @Nullable @Nullable Collection<KeyCacheObject> keys, boolean forcePrimary, @Nullable @Nullable UUID subjId, String taskName, boolean deserializeBinary, boolean recovery, @Nullable @Nullable javax.cache.expiry.ExpiryPolicy expiryPlc, boolean skipVal, boolean skipStore, boolean needVer)
tx - Transaction.keys - Keys to load.forcePrimary - Force primary flag.subjId - Subject ID.taskName - Task name.deserializeBinary - Deserialize binary flag.expiryPlc - Expiry policy.skipVal - Skip value flag.skipStore - Skip store flag.needVer - Need version.public void localLoadCache(IgniteBiPredicate<K,V> p, Object[] args) throws IgniteCheckedException
CacheStore.loadCache(IgniteBiInClosure, Object...) method
to load state from the underlying persistent storage. The loaded values
will then be given to the optionally passed in predicate, and, if the predicate returns
true, will be stored in cache. If predicate is null, then
all loaded values will be stored in cache.
Note that this method does not receive keys as a parameter, so it is up to
CacheStore implementation to provide all the data to be loaded.
This method is not transactional and may end up loading a stale value into cache if another thread has updated the value immediately after it has been loaded. It is mostly useful when pre-loading the cache from underlying data store before start, or for read-only caches.
localLoadCache in interface IgniteInternalCache<K,V>localLoadCache in class GridCacheAdapter<K,V>p - Optional predicate (may be null). If provided, will be used to
filter values to be put into cache.args - Optional user arguments to be passed into
CacheStore.loadCache(IgniteBiInClosure, Object...) method.IgniteCheckedException - If loading failed.public void localLoad(Collection<? extends K> keys, javax.cache.expiry.ExpiryPolicy plc, boolean keepBinary) throws IgniteCheckedException
localLoad in class GridCacheAdapter<K,V>keys - Keys to load.plc - Optional expiry policy.IgniteCheckedException - If failed.public IgniteInternalFuture<?> localLoadCacheAsync(IgniteBiPredicate<K,V> p, Object[] args)
CacheStore.loadCache(IgniteBiInClosure, Object...) method
to reload state from the underlying persistent storage. The reloaded values
will then be given to the optionally passed in predicate, and if the predicate returns
true, will be stored in cache. If predicate is null, then
all reloaded values will be stored in cache.
Note that this method does not receive keys as a parameter, so it is up to
CacheStore implementation to provide all the data to be loaded.
This method is not transactional and may end up loading a stale value into cache if another thread has updated the value immediately after it has been loaded. It is mostly useful when pre-loading the cache from underlying data store before start, or for read-only caches.
localLoadCacheAsync in interface IgniteInternalCache<K,V>localLoadCacheAsync in class GridCacheAdapter<K,V>p - Optional predicate (may be null). If provided, will be used to
filter values to be put into cache.args - Optional user arguments to be passed into
CacheStore.loadCache(IgniteBiInClosure, Object...) method.protected void processGetResponse(UUID nodeId, GridNearGetResponse res)
nodeId - Sender ID.res - Response.public int size()
IgniteInternalCache. It is essentially the
size of cache key set and is semantically identical to {Cache.keySet().size().
NOTE: this operation is not distributed and returns only the number of entries cached on this node.
size in interface IgniteInternalCache<K,V>size in class GridCacheAdapter<K,V>public long sizeLong()
IgniteInternalCache. It is essentially the
size of cache key set and is semantically identical to {Cache.keySet().size().
NOTE: this operation is not distributed and returns only the number of entries cached on this node.
sizeLong in interface IgniteInternalCache<K,V>sizeLong in class GridCacheAdapter<K,V>public int primarySize()
CacheMode.LOCAL non-distributed
cache mode, this method is identical to IgniteInternalCache.size().
For CacheMode.PARTITIONED and CacheMode.REPLICATED modes, this method will
return number of primary entries cached on this node (excluding any backups). The complexity of
this method is O(P), where P is the total number of partitions.
NOTE: this operation is not distributed and returns only the number of primary entries cached on this node.
primarySize in interface IgniteInternalCache<K,V>primarySize in class GridCacheAdapter<K,V>public long primarySizeLong()
CacheMode.LOCAL
non-distributed cache mode, this method is identical to IgniteInternalCache.size().
For CacheMode.PARTITIONED and CacheMode.REPLICATED modes, this method will
return number of primary entries cached on this node (excluding any backups). The complexity of
this method is O(P), where P is the total number of partitions.
NOTE: this operation is not distributed and returns only the number of primary entries cached on this node.
primarySizeLong in interface IgniteInternalCache<K,V>primarySizeLong in class GridCacheAdapter<K,V>public int nearSize()
Note that for LOCAL non-distributed caches this method will always return 0
nearSize in interface IgniteInternalCache<K,V>nearSize in class GridCacheAdapter<K,V>0 if cache is not CacheMode.PARTITIONED.public Set<javax.cache.Cache.Entry<K,V>> entrySet(@Nullable CacheEntryPredicate... filter)
entrySet in class GridCacheAdapter<K,V>filter - Filters to evaluate.public boolean evict(K key)
evict in interface IgniteInternalCache<K,V>evict in class GridCacheAdapter<K,V>key - Key to evict from cache.True if entry could be evicted, false otherwise.public void evictAll(Collection<? extends K> keys)
evictAll in interface IgniteInternalCache<K,V>evictAll in class GridCacheAdapter<K,V>keys - Keys to evict.public boolean clearLocally(K key)
Note that this operation is local as it merely clears an entry from local cache. It does not remove entries from remote caches or from underlying persistent storage.
clearLocally in interface IgniteInternalCache<K,V>clearLocally in class GridCacheAdapter<K,V>key - Key to clearLocally.True if entry was successfully cleared from cache, false
if entry was in use at the time of this method invocation and could not be
cleared.public void clearLocallyAll(Set<? extends K> keys, boolean srv, boolean near, boolean readers)
Note that this operation is local as it merely clears an entry from local cache. It does not remove entries from remote caches or from underlying persistent storage.
clearLocallyAll in interface IgniteInternalCache<K,V>clearLocallyAll in class GridCacheAdapter<K,V>keys - Keys to clearLocally.srv - Whether to clear server cache.near - Whether to clear near cache.readers - Whether to clear readers.public long offHeapEntriesCount()
offHeapEntriesCount in interface IgniteInternalCache<K,V>offHeapEntriesCount in class GridCacheAdapter<K,V>public long offHeapAllocatedSize()
offHeapAllocatedSize in interface IgniteInternalCache<K,V>offHeapAllocatedSize in class GridCacheAdapter<K,V>public List<GridCacheClearAllRunnable<K,V>> splitClearLocally(boolean srv, boolean near, boolean readers)
splitClearLocally in class GridCacheAdapter<K,V>srv - Whether to clear server cache.near - Whether to clear near cache.readers - Whether to clear readers.public String toString()
toString in class GridDistributedCacheAdapter<K,V>
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.11.0 Release Date : September 11 2021