Cacheing


Cacheing




This implementation of the BTree includes a cache. The cache allows any number of index and data pages in the tree to be held in memory. This significantly reduces access speeds to data in the tree since the number of relatively slow disk accesses is reduced. While both index and data pages can be held in memory if there is insufficient memory for all the pages to be held it is better to hold index pages rather than data pages. This is because index pages are accessed more frequently since any access to the data must first go through the index page 'tree'. In the section on performance comparative figures are shown for various levels of cacheing of index and data pages.

If you wish to use a cached BTree then you can set the number of index and data pages to be buffered in the methods to create new and use existing BTrees.