This software provides a straightforward buffer cache that operates in a single process and does not require locking in memory.
The buffer cache consists of various Buffer Cache Elements (BCEs), which is a unique wrapper class for simple byte buffers (blocks). The BCE has two significant callback functions; the first one is called 'pin,' which pins a block as long as the bceref (returned via GetFree or ReadBlock) is within the scope. The BufCa ties a scalar class to unpin the block when the bceref is garbage collected. The 'pin' function provides an advisory locking mechanism, which could be updated into a true locking mechanism.
The second callback function is called 'dirty,' which marks a block as dirty if it is modified. The in-memory buffer cache is designed to form the basis of a more complicated multi-process buffer cache with locking, which is file-based.
To use the buffer cache, the user first needs to get a free block with the GetFree method, and obtain the actual Buffer Cache Element and block number. Further, the block number can be used later to revisit the Buffer Cache Element, and the same block can be read again using the ReadBlock method.
Overall, Genezzo::BufCa::BufCa is an excellent software module for a single process buffer cache that operates smoothly without any locking mechanisms.
Version 0.72: N/A