WriteBatchWorldProvider 5.47.0
Extends WritableWorldProvider
A writable world provider that can group the writes of several chunks into one write.
Between WriteBatchWorldProvider::beginWriteBatch() and WriteBatchWorldProvider::commitWriteBatch(), WritableWorldProvider::saveChunk() may keep the data of the chunk in memory instead of writing it at once.
- The data of a chunk is still written atomically: all of it or nothing.
- Every read of the provider (loading a chunk, iterating chunks, raw database access) first writes what is kept, so reads always see the latest saved data.
- Batches nest: only the outermost commit writes. The provider may also write early, e.g. when a lot is kept.
- If a write fails, the exception is thrown and the data is kept: the next commit or read writes it again (as do later writes on close()).
Methods
beginWriteBatch()
php
public function beginWriteBatch() : voidcommitWriteBatch()
php
public function commitWriteBatch() : voidEnds the batch started by the matching WriteBatchWorldProvider::beginWriteBatch(). The outermost commit writes everything kept.
