|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.hsqldb.Cache
Cache class declaration
The cache class implements the handling of cached tables.
Row
,
CacheFree
Constructor Summary | |
(package private) |
Cache(java.lang.String name)
Cache constructor declaration |
Method Summary | |
(package private) void |
add(Row r)
add method declaration |
(package private) void |
cleanUp()
cleanUp method declaration |
(package private) void |
flush()
flush method declaration |
(package private) void |
free(Row r,
int pos,
int length)
free method declaration |
(package private) Row |
getRow(int pos,
Table t)
getRow method declaration |
(package private) void |
open(boolean readonly)
open method declaration |
(package private) void |
shutdown()
shutdown method declaration |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
Cache(java.lang.String name)
The cache constructor sets up the initial parameters of the cache object, setting the name used for the file, etc.
name
- of database fileMethod Detail |
void open(boolean readonly) throws java.sql.SQLException
The open method creates or opens a database file.
flag
- that indicates if this cache is readonlyvoid flush() throws java.sql.SQLException
The flush method saves all cached data to the file, saves the free position and closes the file.
void shutdown() throws java.sql.SQLException
the shutdown method closes the cache file. It does not flush pending writes.
void free(Row r, int pos, int length) throws java.sql.SQLException
This method marks space in the database file as free.
Note: If more than MAX_FREE_COUNT free positios then they are probably all are too small anyway; so we start a new list
todo: This is wrong when deleting lots of records
r
- (Row object to be marked free)pos
- (Offset in the file this Row was stored at)length
- (Size of the Row object to free)void add(Row r) throws java.sql.SQLException
This method adds a Row to the Cache. It walks the list of CacheFree objects to see if there is available space to store the new Row, reusing space if it exists, otherwise we grow the file.
r
- (Row to be added to Cache)Row getRow(int pos, Table t) throws java.sql.SQLException
This method reads a Row object from the cache.
pos
- (offset of the requested Row in the cache)t
- (Table this Row belongs to)void cleanUp() throws java.sql.SQLException
This method cleans up the cache when it grows too large. It works by checking Rows in held in the Cache's iLastAccess member and removing Rows that haven't been accessed in the longest time.
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |