org.apache.ignite.internal.processors.cache.distributed.dht.colocated

## Class GridDhtDetachedCacheEntry

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheMapEntry
  - - org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheEntry
    - - org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtDetachedCacheEntry

All Implemented Interfaces:
  GridCacheEntryEx

    public class GridDhtDetachedCacheEntry
    extends GridDistributedCacheEntry

Detached cache entry.

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.cache.GridCacheMapEntry

`ATOMIC_VER_COMPARATOR, cctx, flags, key, log, logRef, startVer, val, valPtr, ver`

### Constructor Summary

Constructors
Constructor and Description
`GridDhtDetachedCacheEntry(GridCacheContext ctx, KeyCacheObject key, int hash, CacheObject val, GridCacheMapEntry next, long ttl, int hdrId)`

### Method Summary

Methods
`boolean` `addRemoved(GridCacheVersion ver)`
`protected void` `clearIndex(CacheObject val)` Clears index.
`boolean` `detached()`
`void` `resetFromPrimary(CacheObject val, GridCacheVersion ver)` Sets value to detached entry so it can be retrieved in transactional gets.
`String` `toString()`
`CacheObject` `unswap(boolean ignoreFlags, boolean needVal)` Unswaps an entry.
`protected void` `updateIndex(CacheObject val, long expireTime, GridCacheVersion ver, CacheObject old)` Updates cache index.
`protected void` `value(CacheObject val)` Sets entry value.
`protected CacheObject` `valueBytesUnlocked()`

### Methods inherited from class org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheEntry

`addLocal, addRemote, addRemote, checkCallbacks, checkOwnerChanged, checkRemoved, checkThreadChain, doneRemote, doneRemote, orderCompleted, readyLock, readyNearLock, recheck, refreshRemotes, remoteMvccSnapshot, removeExplicitNodeLocks, removeLock, removeLock, tmLock, txUnlock`

### Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheMapEntry

`addMeta, candidate, candidate, checkObsolete, clear, clearReader, clearReaders, context, deleted, deletedUnlocked, deletedUnlocked, equals, evictInBatchInternal, evictInternal, expireTime, expireTimeExtras, expireTimeUnlocked, hashCode, hasLockCandidate, hasLockCandidate, hasLockCandidateUnsafe, hasMeta, hasReaders, hasValue, hasValueUnlocked, info, initialValue, initialValue, innerGet, innerReload, innerRemove, innerSet, innerUpdate, innerUpdateLocal, invalidate, invalidate, isDht, isInternal, isLocal, isNear, isNew, isNewLocked, isOffHeapValuesOnly, isReplicated, isStartVersion, key, keyValue, localCandidate, localCandidates, localOwner, lockedBy, lockedByAny, lockedByThread, lockedByThread, lockedByThread, lockedByThreadUnsafe, lockedByUnsafe, lockedLocally, lockedLocallyByIdOrThread, lockedLocallyUnsafe, markObsolete, markObsolete0, markObsoleteIfEmpty, markObsoleteVersion, memorySize, meta, mvccExtras, mvccExtras, obsolete, obsolete, obsoleteOrDeleted, obsoleteVersion, obsoleteVersionExtras, obsoleteVersionExtras, onInvalidate, onMarkedObsolete, onTtlExpired, partition, partitionValid, peek, peek, peek, peek0, peekVisibleValue, poke, putMetaIfAbsent, rawExpireTime, rawGet, rawGetOrUnmarshal, rawGetOrUnmarshalUnlocked, rawPut, rawTtl, readExternalMeta, readThrough, recordNodeId, releaseSwap, removeMeta, removeMeta, replaceMeta, saveValueForIndexUnlocked, startVersion, ttl, ttlAndExpireTimeExtras, ttlExtras, txKey, unswap, update, updateTtl, valid, valueBytes, valueBytes, valueBytes0, version, versionedEntry, versionedValue, visitable, wrap, wrapEviction, wrapLazyValue, wrapVersioned, writeExternalMeta`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### GridDhtDetachedCacheEntry

    public GridDhtDetachedCacheEntry(GridCacheContext ctx,
                             KeyCacheObject key,
                             int hash,
                             CacheObject val,
                             GridCacheMapEntry next,
                             long ttl,
                             int hdrId)

Parameters:
  `ctx` - Cache context.
  `key` - Cache key.
  `hash` - Key hash value.
  `val` - Entry value.
  `next` - Next entry in the linked list.
  `ttl` - Time to live.
  `hdrId` - Header ID.

### Method Detail

#### resetFromPrimary

    public void resetFromPrimary(CacheObject val,
                        GridCacheVersion ver)
                          throws IgniteCheckedException

Sets value to detached entry so it can be retrieved in transactional gets.

Parameters:
  `val` - Value.
  `ver` - Version.
Throws:
  `IgniteCheckedException` - If value unmarshalling failed.

#### unswap

    @Nullable
    public CacheObject unswap(boolean ignoreFlags,
                              boolean needVal)
                       throws IgniteCheckedException

Unswaps an entry.

Specified by:
  `unswap` in interface `GridCacheEntryEx`
Overrides:
  `unswap` in class `GridCacheMapEntry`
Parameters:
  `ignoreFlags` - Whether to ignore swap flags.
  `needVal` - If `false` then do not to deserialize value during unswap.
Returns:
  Value.
Throws:
  `IgniteCheckedException` - If failed.

#### value

    protected void value(@Nullable
             CacheObject val)

Sets entry value. If off-heap value storage is enabled, will serialize value to off-heap.

Overrides:
  `value` in class `GridCacheMapEntry`
Parameters:
  `val` - Value to store.

#### valueBytesUnlocked

    protected CacheObject valueBytesUnlocked()

Overrides:
  `valueBytesUnlocked` in class `GridCacheMapEntry`
Returns:
  Value bytes.

#### updateIndex

    protected void updateIndex(CacheObject val,
                   long expireTime,
                   GridCacheVersion ver,
                   CacheObject old)
                        throws IgniteCheckedException

Updates cache index.

Overrides:
  `updateIndex` in class `GridCacheMapEntry`
Parameters:
  `val` - Value.
  `expireTime` - Expire time.
  `ver` - New entry version.
  `old` - Previous value.
Throws:
  `IgniteCheckedException` - If update failed.

#### clearIndex

    protected void clearIndex(CacheObject val)
                       throws IgniteCheckedException

Clears index.

Overrides:
  `clearIndex` in class `GridCacheMapEntry`
Parameters:
  `val` - Previous value (if needed for index update).
Throws:
  `IgniteCheckedException` - If failed.

#### detached

    public boolean detached()

Specified by:
  `detached` in interface `GridCacheEntryEx`
Overrides:
  `detached` in class `GridCacheMapEntry`
Returns:
  `False` if entry belongs to cache map, `true` if this entry was created in colocated cache and node is not primary for this key.

#### toString

    public String toString()

Overrides:
  `toString` in class `GridDistributedCacheEntry`

#### addRemoved

    public boolean addRemoved(GridCacheVersion ver)

Overrides:
  `addRemoved` in class `GridDistributedCacheEntry`
Parameters:
  `ver` - Lock version.
Returns:
  `True` if removed.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0
Release Date | : March 31 2015