public abstract class GridNearCacheAdapter<K,V> extends GridDistributedCacheAdapter<K,V>
GridCacheAdapter.AsyncOp<T>, GridCacheAdapter.CacheExpiryPolicy, GridCacheAdapter.FutureHolder, GridCacheAdapter.UpdateGetTimeStatClosure<T>, GridCacheAdapter.UpdatePutAndGetTimeStatClosure<T>, GridCacheAdapter.UpdatePutTimeStatClosure<T>, GridCacheAdapter.UpdateRemoveTimeStatClosure<T>, GridCacheAdapter.UpdateTimeStatClosure<T>| Modifier | Constructor and Description |
|---|---|
protected |
GridNearCacheAdapter()
Empty constructor required for
Externalizable. |
protected |
GridNearCacheAdapter(GridCacheContext<K,V> ctx) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearLocally0(Collection<? extends K> keys,
CacheEntryPredicate[] filter) |
boolean |
clearLocally0(K key,
CacheEntryPredicate[] filter) |
abstract GridDhtCacheAdapter<K,V> |
dht() |
javax.cache.Cache.Entry<K,V> |
entry(K key)
Gets entry from cache with the specified key.
|
GridCacheEntryEx |
entryEx(KeyCacheObject key,
boolean touch) |
GridCacheEntryEx |
entryEx(KeyCacheObject key,
long topVer) |
GridNearCacheEntry |
entryExx(KeyCacheObject key,
long topVer) |
Set<javax.cache.Cache.Entry<K,V>> |
entrySet(CacheEntryPredicate... filter) |
Set<javax.cache.Cache.Entry<K,V>> |
entrySet(int part)
Gets set containing cache entries that belong to provided partition or
null
if partition is not found locally. |
boolean |
evict(K key,
CacheEntryPredicate[] filter) |
void |
evictAll(Collection<? extends K> keys,
CacheEntryPredicate[] filter) |
boolean |
evictNearOnly(K key,
CacheEntryPredicate[] filter) |
long |
igfsDataSpaceMax()
Get maximum space available for IGFS.
|
long |
igfsDataSpaceUsed()
Get current amount of used IGFS space in bytes.
|
protected void |
init()
Post constructor initialization for subclasses.
|
boolean |
isAllLockedNearOnly(Iterable<? extends K> keys) |
boolean |
isIgfsDataCache()
Checks whether this cache is IGFS data cache.
|
boolean |
isLocked(K key)
Checks if any node owns a lock for this key.
|
boolean |
isLockedNearOnly(K key) |
boolean |
isMongoDataCache()
Checks whether this cache is Mongo data cache.
|
boolean |
isMongoMetaCache()
Checks whether this cache is Mongo meta cache.
|
boolean |
isNear() |
Set<K> |
keySet(CacheEntryPredicate[] filter)
Set of keys cached on this node.
|
IgniteInternalFuture<Map<K,V>> |
loadAsync(IgniteInternalTx tx,
Collection<KeyCacheObject> keys,
boolean reload,
boolean forcePrimary,
UUID subjId,
String taskName,
boolean deserializePortable,
javax.cache.expiry.ExpiryPolicy expiryPlc,
boolean skipVal) |
void |
localLoad(Collection<? extends K> keys,
javax.cache.expiry.ExpiryPolicy plc) |
void |
localLoadCache(IgniteBiPredicate<K,V> p,
Object[] args)
Delegates to
CacheStore.loadCache(org.apache.ignite.lang.IgniteBiInClosure,Object...) method
to load state from the underlying persistent storage. |
IgniteInternalFuture<?> |
localLoadCacheAsync(IgniteBiPredicate<K,V> p,
Object[] args)
Asynchronously delegates to
CacheStore.loadCache(org.apache.ignite.lang.IgniteBiInClosure, Object...) method
to reload state from the underlying persistent storage. |
Set<javax.cache.Cache.Entry<K,V>> |
nearEntries() |
Iterator<javax.cache.Cache.Entry<K,V>> |
nearEntriesIterator() |
Set<K> |
nearKeySet(CacheEntryPredicate filter) |
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.
|
Iterator<Map.Entry<K,V>> |
offHeapIterator()
Gets iterator over keys and values belonging to this cache off-heap memory on local node.
|
void |
onIgfsDataSizeChanged(long delta)
Callback invoked when data is added to IGFS cache.
|
V |
peek(K key,
CacheEntryPredicate filter) |
V |
peek(K key,
Collection<GridCachePeekMode> modes)
Peeks at cached value using optional set of peek modes.
|
GridNearCacheEntry |
peekExx(KeyCacheObject key) |
V |
peekNearOnly(K key)
Peeks only near cache without looking into DHT cache.
|
GridCachePreloader<K,V> |
preloader() |
Set<javax.cache.Cache.Entry<K,V>> |
primaryEntrySet(CacheEntryPredicate... filter) |
Set<K> |
primaryKeySet(CacheEntryPredicate... filter) |
int |
primarySize()
Gets the number of all primary entries cached on this node.
|
Collection<V> |
primaryValues(CacheEntryPredicate... filter) |
protected void |
processGetResponse(UUID nodeId,
GridNearGetResponse res) |
V |
promote(K key)
This method promotes cache entry by given key, if any, from offheap or swap storage
into memory.
|
V |
promote(K key,
boolean deserializePortable) |
void |
promoteAll(Collection<? extends K> keys)
This method unswaps cache entries by given keys, if any, from swap storage
into memory.
|
javax.cache.Cache.Entry<K,V> |
randomEntry()
Gets a random entry out of cache.
|
IgniteInternalFuture<Object> |
readThroughAllAsync(Collection<KeyCacheObject> keys,
boolean reload,
boolean skipVals,
IgniteInternalTx tx,
UUID subjId,
String taskName,
IgniteBiInClosure<KeyCacheObject,Object> vis) |
V |
reload(K key)
Reloads a single key from persistent storage.
|
int |
size()
Gets the number of all entries cached on this node.
|
List<GridCacheClearAllRunnable<K,V>> |
splitClearLocally()
Split clearLocally all task into multiple runnables.
|
Iterator<Map.Entry<K,V>> |
swapIterator()
Gets iterator over keys and values belonging to this cache swap space on local node.
|
long |
swapKeys()
Gets number of swap entries (keys).
|
long |
swapSize()
Gets size in bytes for swap space.
|
String |
toString() |
Collection<V> |
values(CacheEntryPredicate... filter) |
lockAllAsync, lockAllAsync, removeAll, removeAllAsync, removeVersionedEntry, txLockAsyncaffinity, allEntries, asyncOp, asyncOpAcquire, asyncOpRelease, awaitLastFut, cache, checkJta, clear, clear, clear, clearAll, clearAsync, clearAsync, clearAsync, clearLocally, clearLocally, clearLocally, clearLocallyAll, commitTxAsync, configuration, containsKey, containsKeyAsync, containsKeys, containsKeysAsync, containsValue, context, entries, entryEx, entryEx, entryExSafe, entrySet, entrySetx, evict, evictAll, evictAll, expiry, expiryPolicy, flags, flagsOff, flagsOn, forceRepartition, forSubjectId, get, get, get, getAll, getAll, getAllAsync, getAllAsync, getAllAsync, getAllAsync, getAllAsync0, getAllOutTx, getAllOutTxAsync, getAsync, getAsync, getForcePrimary, getForcePrimaryAsync, globalPrimarySize, globalSize, gridProjection, igniteIterator, invoke, invokeAll, invokeAll, invokeAllAsync, invokeAllAsync, invokeAsync, isColocated, isDht, isDhtAtomic, isEmpty, isLocal, isLockedByThread, iterator, iterator, keepPortable, keepPortable0, keySet, loadAll, localEntries, localPeek, localRemoveAll, localRemoveAll, localSize, lock, lockAll, lockAsync, log, map, metrics, metrics0, mxBean, name, onDeferredDelete, onKernalStart, onKernalStop, onUndeploy, overflowSize, peek, peek0, peek0, peek0, peekAll0, peekEx, peekEx, predicate, primaryEntrySet, primaryEntrySetx, primaryKeySet, primaryValues, printMemoryStats, projection, projection, put, put, putAll, putAllAsync, putAllConflict, putAllConflictAsync, putAsync, putAsync, putIfAbsent, putIfAbsentAsync, putx, putx, putxAsync, putxAsync, putxIfAbsent, putxIfAbsentAsync, queries, readExternal, readResolve, reloadAllAsync0, reloadAsync, remove, remove, remove, removeAll, removeAllAsync, removeAllConflict, removeAllConflictAsync, removeAsync, removeAsync, removeAsync, removeEntry, removeIfObsolete, removex, removex, removex, removexAsync, removexAsync, removexAsync, replace, replace, replaceAsync, replaceAsync, replacex, replacex, replacexAsync, replacexAsync, saveFuture, size, sizeAsync, start, startInfo, stop, stopInfo, toMap, tx, txStart, txStart, txStart, txStartEx, txSynchronizations, txSynchronize, txUnsynchronize, unlock, validateCacheKey, validateCacheKeys, values, withExpiryPolicy, writeExternalclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitunlockAllprotected GridNearCacheAdapter()
Externalizable.protected GridNearCacheAdapter(GridCacheContext<K,V> ctx)
ctx - Context.protected void init()
init in class GridCacheAdapter<K,V>public abstract GridDhtCacheAdapter<K,V> dht()
public boolean isNear()
isNear in class GridCacheAdapter<K,V>True if this is near cache.public GridCachePreloader<K,V> preloader()
preloader in class GridCacheAdapter<K,V>public GridCacheEntryEx entryEx(KeyCacheObject key, boolean touch)
entryEx in class GridCacheAdapter<K,V>key - Entry key.touch - Whether created entry should be touched.null).public GridCacheEntryEx entryEx(KeyCacheObject key, long topVer)
entryEx in class GridCacheAdapter<K,V>key - Entry key.topVer - Topology version.null).public GridNearCacheEntry entryExx(KeyCacheObject key, long topVer)
key - Key.topVer - Topology version.@Nullable public 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 CacheProjection<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<Object> readThroughAllAsync(Collection<KeyCacheObject> keys, boolean reload, boolean skipVals, IgniteInternalTx tx, @Nullable UUID subjId, String taskName, IgniteBiInClosure<KeyCacheObject,Object> vis)
readThroughAllAsync in class GridCacheAdapter<K,V>keys - Keys.reload - Reload flag.tx - Transaction.subjId - Subject ID.taskName - Task name.vis - Visitor.public V reload(K key) throws IgniteCheckedException
CacheStore#load(Transaction, Object)
method.
reload in interface CacheProjection<K,V>reload in class GridCacheAdapter<K,V>key - Key.IgniteCheckedException - If failed.public IgniteInternalFuture<Map<K,V>> loadAsync(@Nullable IgniteInternalTx tx, @Nullable Collection<KeyCacheObject> keys, boolean reload, boolean forcePrimary, @Nullable UUID subjId, String taskName, boolean deserializePortable, @Nullable javax.cache.expiry.ExpiryPolicy expiryPlc, boolean skipVal)
tx - Transaction.keys - Keys to load.reload - Reload flag.forcePrimary - Force primary flag.subjId - Subject ID.taskName - Task name.deserializePortable - Deserialize portable flag.expiryPlc - Expiry policy.public void localLoadCache(IgniteBiPredicate<K,V> p, Object[] args) throws IgniteCheckedException
CacheStore.loadCache(org.apache.ignite.lang.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 GridCacheProjectionEx<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(org.apache.ignite.lang.IgniteBiInClosure, Object...) method.IgniteCheckedException - If loading failed.public void localLoad(Collection<? extends K> keys, javax.cache.expiry.ExpiryPolicy plc) 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(org.apache.ignite.lang.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 GridCacheProjectionEx<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(org.apache.ignite.lang.IgniteBiInClosure,Object...) method.protected void processGetResponse(UUID nodeId, GridNearGetResponse res)
nodeId - Sender ID.res - Response.public int size()
GridCache projection. 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 CacheProjection<K,V>size in class GridCacheAdapter<K,V>public int primarySize()
CacheMode.LOCAL non-distributed
cache mode, this method is identical to CacheProjection.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 CacheProjection<K,V>primarySize in class GridCacheAdapter<K,V>public int nearSize()
Note that for LOCAL non-distributed caches this method will always return 0
nearSize in interface CacheProjection<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 Set<javax.cache.Cache.Entry<K,V>> entrySet(int part)
null
if partition is not found locally.
NOTE: this operation is not distributed and returns only the entries cached on this node.
entrySet in interface CacheProjection<K,V>entrySet in class GridCacheAdapter<K,V>part - Partition.null if partition is
not found locally.public Set<javax.cache.Cache.Entry<K,V>> primaryEntrySet(@Nullable CacheEntryPredicate... filter)
primaryEntrySet in class GridCacheAdapter<K,V>filter - Filters to evaluate.public Set<K> keySet(@Nullable CacheEntryPredicate[] filter)
Iterator over this set will not fail if set was concurrently updated by another thread. This means that iterator may or may not return latest keys depending on whether they were added before or after current iterator position.
NOTE: this operation is not distributed and returns only the keys cached on this node.
keySet in interface CacheProjection<K,V>keySet in class GridCacheAdapter<K,V>filter - Filters to evaluate.public Set<K> nearKeySet(@Nullable CacheEntryPredicate filter)
filter - Entry filter.public Set<K> primaryKeySet(@Nullable CacheEntryPredicate... filter)
primaryKeySet in class GridCacheAdapter<K,V>filter - Primary key set.public Collection<V> values(CacheEntryPredicate... filter)
values in class GridCacheAdapter<K,V>public Collection<V> primaryValues(@Nullable CacheEntryPredicate... filter)
primaryValues in class GridCacheAdapter<K,V>filter - Filters to evaluate.public boolean evict(K key, @Nullable CacheEntryPredicate[] filter)
evict in class GridCacheAdapter<K,V>key - Key.filter - Filters to evaluate.True if evicted.public boolean evictNearOnly(K key, @Nullable CacheEntryPredicate[] filter)
key - Key to evict.filter - Optional filter.True if evicted.public void evictAll(Collection<? extends K> keys, @Nullable CacheEntryPredicate[] filter)
evictAll in class GridCacheAdapter<K,V>keys - Keys.filter - Filters to evaluate.public javax.cache.Cache.Entry<K,V> entry(K key)
Note that this method can return null if projection is configured as
pre-filtered and entry key and value don't pass key-value filter of the projection.
entry in interface CacheProjection<K,V>entry in class GridCacheAdapter<K,V>key - Entry key.null if projection pre-filtering was not passed.@Nullable public V peekNearOnly(K key)
key - Key.public V peek(K key, @Nullable CacheEntryPredicate filter)
peek in class GridCacheAdapter<K,V>key - Key.filter - Filter to evaluate.public V peek(K key, @Nullable Collection<GridCachePeekMode> modes) throws IgniteCheckedException
non-null value is found, it will be immediately returned.
Note that if modes are not provided this method works exactly the same way as
CacheProjection.peek(Object), implicitly using GridCachePeekMode.SMART mode.
peek in interface CacheProjection<K,V>peek in class GridCacheAdapter<K,V>key - Entry key.modes - Optional set of peek modes.IgniteCheckedException - If peek operation failed.public boolean clearLocally0(K key, @Nullable CacheEntryPredicate[] filter)
clearLocally0 in class GridCacheAdapter<K,V>key - Key.filter - Filters to evaluate.True if cleared.public void clearLocally0(Collection<? extends K> keys, @Nullable CacheEntryPredicate[] filter)
clearLocally0 in class GridCacheAdapter<K,V>keys - Keys.filter - Filters to evaluate.public V promote(K key, boolean deserializePortable) throws IgniteCheckedException
promote in class GridCacheAdapter<K,V>key - Key.deserializePortable - Deserialize portable flag.IgniteCheckedException - If failed.public V promote(K key) throws IgniteCheckedException
CacheFlag.SKIP_SWAP, CacheFlag.READ.promote in interface CacheProjection<K,V>promote in class GridCacheAdapter<K,V>key - Key to promote entry for.null for non-existing key.IgniteCheckedException - If promote failed.public void promoteAll(@Nullable Collection<? extends K> keys) throws IgniteCheckedException
CacheFlag.SKIP_SWAP, CacheFlag.READ.promoteAll in interface CacheProjection<K,V>promoteAll in class GridCacheAdapter<K,V>keys - Keys to promote entries for.IgniteCheckedException - If promote failed.@Nullable public javax.cache.Cache.Entry<K,V> randomEntry()
O(S * N/64)where
N is the size of internal hash
table and S is the number of hash table buckets to sample, which is 5
by default. However, if the table is pretty dense, with density factor of N/64,
which is true for near fully populated caches, this method will generally perform significantly
faster with complexity of O(S) where S = 5.
Note that this method is not available on CacheProjection API since it is
impossible (or very hard) to deterministically return a number value when pre-filtering
and post-filtering is involved (e.g. projection level predicate filters).
randomEntry in interface GridCache<K,V>randomEntry in class GridCacheAdapter<K,V>null if cache is empty.public Iterator<Map.Entry<K,V>> swapIterator() throws IgniteCheckedException
Returned iterator supports remove operation which delegates to
#removex(Object, org.apache.ignite.lang.IgnitePredicate[]) method.
CacheFlag.SKIP_SWAP.swapIterator in interface GridCache<K,V>swapIterator in class GridCacheAdapter<K,V>IgniteCheckedException - If failed.CacheProjection.promote(Object)public Iterator<Map.Entry<K,V>> offHeapIterator() throws IgniteCheckedException
Returned iterator supports remove operation which delegates to
#removex(Object, org.apache.ignite.lang.IgnitePredicate[]) method.
offHeapIterator in interface GridCache<K,V>offHeapIterator in class GridCacheAdapter<K,V>IgniteCheckedException - If failed.public long offHeapEntriesCount()
offHeapEntriesCount in interface GridCache<K,V>offHeapEntriesCount in class GridCacheAdapter<K,V>public long offHeapAllocatedSize()
offHeapAllocatedSize in interface GridCache<K,V>offHeapAllocatedSize in class GridCacheAdapter<K,V>public long swapSize()
throws IgniteCheckedException
swapSize in interface GridCache<K,V>swapSize in class GridCacheAdapter<K,V>IgniteCheckedException - If failed.public long swapKeys()
throws IgniteCheckedException
swapKeys in interface GridCache<K,V>swapKeys in class GridCacheAdapter<K,V>IgniteCheckedException - If failed.public boolean isIgfsDataCache()
isIgfsDataCache in interface GridCacheProjectionEx<K,V>isIgfsDataCache in class GridCacheAdapter<K,V>True in case this cache is IGFS data cache.public long igfsDataSpaceUsed()
igfsDataSpaceUsed in interface GridCacheProjectionEx<K,V>igfsDataSpaceUsed in class GridCacheAdapter<K,V>public long igfsDataSpaceMax()
igfsDataSpaceMax in interface GridCacheProjectionEx<K,V>igfsDataSpaceMax in class GridCacheAdapter<K,V>public void onIgfsDataSizeChanged(long delta)
onIgfsDataSizeChanged in class GridCacheAdapter<K,V>delta - Size delta.public boolean isMongoDataCache()
isMongoDataCache in interface GridCacheProjectionEx<K,V>isMongoDataCache in class GridCacheAdapter<K,V>True if this cache is mongo data cache.public boolean isMongoMetaCache()
isMongoMetaCache in interface GridCacheProjectionEx<K,V>isMongoMetaCache in class GridCacheAdapter<K,V>True if this cache is mongo meta cache.public List<GridCacheClearAllRunnable<K,V>> splitClearLocally()
splitClearLocally in class GridCacheAdapter<K,V>public Iterator<javax.cache.Cache.Entry<K,V>> nearEntriesIterator()
public String toString()
toString in class GridDistributedCacheAdapter<K,V>
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC3 Release Date : March 24 2015