Package org.h2.util
Class CacheObject
java.lang.Object
org.h2.util.CacheObject
- All Implemented Interfaces:
Comparable<CacheObject>
- Direct Known Subclasses:
CacheHead
The base object for all cached objects.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe next element in the hash chain.The next element in the LRU linked list.The previous element in the LRU linked list. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanCheck if the object can be removed from the cache.intcompareTo(CacheObject other) abstract intGet the estimated used memory.intgetPos()booleanCheck if this cache object has been changed and thus needs to be written back to the storage.booleanisStream()voidsetChanged(boolean b) voidsetPos(int pos)
-
Field Details
-
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. -
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. -
cacheChained
The next element in the hash chain.
-
-
Constructor Details
-
CacheObject
public CacheObject()
-
-
Method Details
-
canRemove
public abstract boolean canRemove()Check if the object can be removed from the cache. For example pinned objects can not be removed.- Returns:
- true if it can be removed
-
getMemory
public abstract int getMemory()Get the estimated used memory.- Returns:
- number of words (one word is 4 bytes)
-
setPos
public void setPos(int pos) -
getPos
public int getPos() -
isChanged
public boolean isChanged()Check if this cache object has been changed and thus needs to be written back to the storage.- Returns:
- if it has been changed
-
setChanged
public void setChanged(boolean b) -
compareTo
- Specified by:
compareToin interfaceComparable<CacheObject>
-
isStream
public boolean isStream()
-