RedM Natives

FLUSH_RESOURCE_KVP

Nonsynchronous operations will not wait for a disk/filesystem flush before returning from a write or delete call.

Hash0xE27C97A0
Runtime nameFlushResourceKvp
NamespaceCFX
SideServer
NameOfficial
Docs

Signature

void FLUSH_RESOURCE_KVP();

Returns void

Description

Cfx.re native reference

Nonsynchronous operations will not wait for a disk/filesystem flush before returning from a write or delete call. They will be much faster than their synchronous counterparts (e.g., bulk operations), however, a system crash may lose the data to some recent operations.

This native ensures all _NO_SYNC operations are synchronized with the disk/filesystem.

Usage

Lua
FlushResourceKvp()

-- always works, by hash
Citizen.InvokeNative(0xe27c97a0)
JavaScript and C#
JavaScript
FlushResourceKvp();

// by hash
Citizen.invokeNative('0xe27c97a0');
C#
Function.Call((Hash)0xe27c97a0);

Examples

LUA · Cfx.re native reference
-- Bulk write many <key, value> pairs to the resource KVP.
local key = "bug_%d"
local value = "unintended_feature_%d"
for i=1,10000 do
	SetResourceKvpNoSync(key:format(i), value:format(i))
end

-- Ensure all data is synchronized to the filesystem
FlushResourceKvp()

See also

Sources

Cfx.re native reference

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.