Package org.apache.sysds.runtime.ooc.cache

# Class BlockEntry

java.lang.Object
org.apache.sysds.runtime.ooc.cache.BlockEntry

public final class BlockEntry extends Object

## Constructor Summary

Constructors
Constructor
Description
`BlockEntry(BlockKey key)`
`BlockEntry(BlockKey key, long size, Object data)`
`BlockEntry(BlockKey key, long size, Object data, BlockState state)`

## Method Summary

Modifier and Type
Method
Description
`int`
`addReference()`
`void`
`addRetainHint()`
`void`
`addRetainHint(int cnt)`
`long`
`clear()`
Tries to clear the underlying data if it is not pinned
`boolean`
`fastPin()`
Tries to increment pin-count if already pinned.
`boolean`
`fastUnpin()`
Tries to unpin but guarantees that it will not remove the last pin.
`int`
`forget()`
`Object`
`getCacheMeta()`
`Object`
`getData()`
`Object`
`getDataUnsafe()`
`BlockKey`
`getKey()`
`int`
`getPinCount()`
`int`
`getReferenceCount()`
`int`
`getRetainHintCount()`
`long`
`getSize()`
`BlockState`
`getState()`
`boolean`
`isPinned()`
`int`
`pin()`
Pins the underlying data in memory
`void`
`removeRetainHint()`
`void`
`setCacheMeta(Object meta)`
`void`
`setDataUnsafe(Object data)`
`void`
`setState(BlockState state)`
`String`
`toString()`
`boolean`
`unpin()`
Unpins the underlying data

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

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### BlockEntry

public BlockEntry(BlockKey key)

### BlockEntry

public BlockEntry(BlockKey key, long size, Object data)

### BlockEntry

public BlockEntry(BlockKey key, long size, Object data, BlockState state)

## Method Details

### getKey

public BlockKey getKey()

### getSize

public long getSize()

### getData

public Object getData()

### getDataUnsafe

public Object getDataUnsafe()

### setDataUnsafe

public void setDataUnsafe(Object data)

### getState

public BlockState getState()

### isPinned

public boolean isPinned()

### getPinCount

public int getPinCount()

### addReference

public int addReference()

### forget

public int forget()

### getReferenceCount

public int getReferenceCount()

### getCacheMeta

public Object getCacheMeta()

### setCacheMeta

public void setCacheMeta(Object meta)

### setState

public void setState(BlockState state)

### addRetainHint

public void addRetainHint(int cnt)

### addRetainHint

public void addRetainHint()

### removeRetainHint

public void removeRetainHint()

### getRetainHintCount

public int getRetainHintCount()

### clear

public long clear()
Tries to clear the underlying data if it is not pinned

Returns:
  the number of cleared bytes (or 0 if could not clear or data was already cleared)

### pin

public int pin()
Pins the underlying data in memory

Returns:
  the new number of pins (0 if pin was unsuccessful)

### fastPin

public boolean fastPin()
Tries to increment pin-count if already pinned. Unpinned entries are not affected by this operation. This allows bypassing the global cache lock.

### unpin

public boolean unpin()
Unpins the underlying data

Returns:
  true if the data is now unpinned

### fastUnpin

public boolean fastUnpin()
Tries to unpin but guarantees that it will not remove the last pin. This allows bypassing the global cache lock.

### toString

public String toString()

Overrides:
  `toString` in class `Object`