FLUSH_RESOURCE_KVP
Nonsynchronous operations will not wait for a disk/filesystem flush before returning from a write or delete call.
Signature
void FLUSH_RESOURCE_KVP();Returns void
Description
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
FlushResourceKvp()
-- always works, by hash
Citizen.InvokeNative(0xe27c97a0)JavaScript and C#
FlushResourceKvp();
// by hash
Citizen.invokeNative('0xe27c97a0');Function.Call((Hash)0xe27c97a0);Examples
-- 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
SET_RESOURCE_KVPA setter for GET_RESOURCE_KVP_STRING.DELETE_RESOURCE_KVP
Sources
Something wrong or missing? Contribute a verified note — corrections ship through pull requests.