Cache helps prevent unnecessary IAVLTree updates and garbage generation.
Returns a Cache, can write to an output Writer via Sync. Not goroutine safe, use syncStateCache if you need concurrent access
Resets the cache to empty initialising the backing map to the same size as the previous iteration
Writes whatever is in the cache to the output Writer state. Does not flush the cache, to do that call Reset() after Sync or use Flush if your wish to use the output state as your next backend