Top Description Fields Constructors Methods
org.h2.util

public abstract Class CacheObject

extends Object
implements Comparable<CacheObject>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable
Known Direct Subclasses
org.h2.util.CacheHead
Imports
org.h2.message.DbException

The base object for all cached objects.

Field Summary

Modifier and TypeField and Description
public CacheObject
cacheChained

The next element in the hash chain.

public CacheObject
cacheNext

The next element in the LRU linked list.

public CacheObject
cachePrevious

The previous element in the LRU linked list.

private boolean
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract boolean

Returns:

true if it can be removed
canRemove
()

Check if the object can be removed from the cache.

public int
compareTo(CacheObject
the object to be compared.
other
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

public abstract int

Returns:

number of words (one word is 4 bytes)
getMemory
()

Get the estimated used memory.

public int
public boolean

Returns:

if it has been changed
isChanged
()

Check if this cache object has been changed and thus needs to be written back to the storage.

public boolean
public void
setChanged(boolean b)

public void
setPos(int pos)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheChainedback to summary
public CacheObject cacheChained

The next element in the hash chain.

cacheNextback to summary
public CacheObject cacheNext

The next element in the LRU linked list. If the next element is the head, then this element is the least recently used object.

cachePreviousback to summary
public CacheObject cachePrevious

The previous element in the LRU linked list. If the previous element is the head, then this element is the most recently used object.

changedback to summary
private boolean changed
posback to summary
private int pos

Constructor Detail

CacheObjectback to summary
public CacheObject()

Method Detail

canRemoveback to summary
public abstract boolean canRemove()

Check if the object can be removed from the cache. For example pinned objects can not be removed.

Returns:boolean

true if it can be removed

compareToback to summary
public int compareTo(CacheObject other)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
other:CacheObject

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
getMemoryback to summary
public abstract int getMemory()

Get the estimated used memory.

Returns:int

number of words (one word is 4 bytes)

getPosback to summary
public int getPos()
isChangedback to summary
public boolean isChanged()

Check if this cache object has been changed and thus needs to be written back to the storage.

Returns:boolean

if it has been changed

isStreamback to summary
public boolean isStream()
setChangedback to summary
public void setChanged(boolean b)
setPosback to summary
public void setPos(int pos)