By default, JungleConfig operates in auto-commit mode — every call toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/himansaBro/JungleConfig/llms.txt
Use this file to discover all available pages before exploring further.
Set, Remove, or RemoveAllKeys is immediately serialized and flushed to the backing store. Transactions let you batch multiple operations together in memory and then either commit them all at once or discard them entirely, giving you full control over when data becomes durable.
Auto-commit mode (default)
In auto-commit mode you simply callSet and the value is persisted before the next line of code runs. This is the simplest way to use JungleConfig and requires no extra setup.
Manual transactions
CallingBeginTransaction() switches the instance into manual mode — auto-commit is disabled and all subsequent Set, Remove, and RemoveAllKeys calls are queued in memory rather than written through immediately.
| Method | Return type | What it does |
|---|---|---|
BeginTransaction() | JungleConfig | Disables auto-commit; starts buffering operations |
Commit() | JungleConfig | Flushes the current buffer to the backing store; transaction stays open |
Rollback() | JungleConfig | Discards the buffer; nothing is written |
EndTransaction() | void | Re-enables auto-commit and immediately flushes any remaining pending saves |
EndTransaction(), which returns void.
Rollback example
If something goes wrong before you commit, callRollback() to throw away every queued operation. Only the in-memory buffer (saveQuery and remList) is cleared — nothing is written to or removed from the backing store. Any writes that were already flushed by an earlier Commit() call within the same transaction are not reversed; Rollback() can only discard what has not yet been committed.
BeginTransaction vs EndTransaction
EndTransaction() does two things at once: it re-enables auto-commit and immediately flushes any saves that are still pending in the buffer. Internally, it sets AutoCommit = true and then calls send(), which calls flush() because AutoCommit is now true. Use it when you want to close out the transaction and return to normal auto-commit behaviour in one step.
Commit(), by contrast, only flushes the current buffer — the transaction remains open and auto-commit stays off (AutoCommit remains false). You can call Commit() multiple times within a single transaction to checkpoint intermediate batches without ending the transaction:
Pending transaction state is held in
NativeInternalTransaction.saveQuery (entries to write) and remList (keys to delete). Calling Rollback() clears both lists in-place without touching the underlying file or cache, so the on-disk state remains unchanged. Importantly, Rollback() only undoes writes that have not yet been committed — any batches already flushed by a previous Commit() call within the same transaction are permanent and cannot be rolled back.