This database software stack implements disk caching. This feature allows to manipulate huge files, minimize the number of time consuming I/O operation and remove the need to keep complete file into memory. The disk caching API provide paged access to a database file via the Cache and Page interfaces.
The disk cache package org.whitebear.cache is stable since 2021
Current disk cache implementation use java.io.RandomAccessFile to access the database file. The disk cache uses java.nio.ByteBuffer to retain in-memory copies of disk content. All classes are thread-safe
CacheCleanupThread is a background thread responsible to remove unused pages from memory. It implements a 2nd chance algorithm
Memory mapping has not been implemented. Initial implementation led to many OutOfMemoryError. The implementation was then changed to use a HashMap to keep copies of the page into memory - into Java runtime's heap space
Copy-on-write and shadow copies feature is implemented by file container layer
Disk cache specification