B-Tree in-place node writes
Got a bit of an issue when using B-Tree as cache files. File cache supports keepalive
, which means whenever a value is read from the cache, the cache timeout value is updated. This causes a write-append to the B-Tree file with the new node which means even with only a read, the file will keep getting larger and larger. Now, we're only increasing by the size of the node that stores __cache_timeout
, but if this node has something massive in it, then we are storing many many unnecessary copies of this data on every write.
Allowing for in-place writes means that if the size of the data that is being written is the same (or even maybe smaller) than the previous data, we should write the node to the same location in the file. This would be done around line #371 to #375 of Btree.php which is the serialized write.