Package org.h2.util
Class CacheSecondLevel
- java.lang.Object
-
- org.h2.util.CacheSecondLevel
-
-
Field Summary
Fields Modifier and Type Field Description private CachebaseCacheprivate java.util.Map<java.lang.Integer,CacheObject>map
-
Constructor Summary
Constructors Constructor Description CacheSecondLevel(Cache cache, java.util.Map<java.lang.Integer,CacheObject> map)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear the cache.CacheObjectfind(int pos)Get an element from the cache if it is available.CacheObjectget(int pos)Get an element in the cache if it is available.java.util.ArrayList<CacheObject>getAllChanged()Get all objects in the cache that have been changed.intgetMaxMemory()Get the maximum memory to be used.intgetMemory()Get the used size in KB.voidput(CacheObject r)Add an element to the cache.booleanremove(int pos)Remove an object from the cache.voidsetMaxMemory(int size)Set the maximum memory to be used by this cache.CacheObjectupdate(int pos, CacheObject record)Update an element in the cache.
-
-
-
Field Detail
-
baseCache
private final Cache baseCache
-
map
private final java.util.Map<java.lang.Integer,CacheObject> map
-
-
Constructor Detail
-
CacheSecondLevel
CacheSecondLevel(Cache cache, java.util.Map<java.lang.Integer,CacheObject> map)
-
-
Method Detail
-
clear
public void clear()
Description copied from interface:CacheClear the cache.
-
find
public CacheObject find(int pos)
Description copied from interface:CacheGet an element from the cache if it is available. This will not move the item to the front of the list.
-
get
public CacheObject get(int pos)
Description copied from interface:CacheGet an element in the cache if it is available. This will move the item to the front of the list.
-
getAllChanged
public java.util.ArrayList<CacheObject> getAllChanged()
Description copied from interface:CacheGet all objects in the cache that have been changed.- Specified by:
getAllChangedin interfaceCache- Returns:
- the list of objects
-
getMaxMemory
public int getMaxMemory()
Description copied from interface:CacheGet the maximum memory to be used.- Specified by:
getMaxMemoryin interfaceCache- Returns:
- the maximum size in KB
-
getMemory
public int getMemory()
Description copied from interface:CacheGet the used size in KB.
-
put
public void put(CacheObject r)
Description copied from interface:CacheAdd an element to the cache. Other items may fall out of the cache because of this. It is not allowed to add the same record twice.
-
remove
public boolean remove(int pos)
Description copied from interface:CacheRemove an object from the cache.
-
setMaxMemory
public void setMaxMemory(int size)
Description copied from interface:CacheSet the maximum memory to be used by this cache.- Specified by:
setMaxMemoryin interfaceCache- Parameters:
size- the maximum size in KB
-
update
public CacheObject update(int pos, CacheObject record)
Description copied from interface:CacheUpdate an element in the cache. This will move the item to the front of the list.
-
-