ramdb/docs/core/addTask.md
Jacob Schmidt 5b9f3402b6
All checks were successful
Build / Build (push) Successful in 30s
docs: add comprehensive documentation and usage examples for ramdb
2025-03-22 16:31:59 -05:00

2.9 KiB

title, icon, excerpt
title icon excerpt
ArmaRAMDb - Add Task mdi:file-text-outline Add task to queue.

ramdb_db_fnc_addTask

Description

Adds a task to the database operation queue. This function is used to schedule database operations that can be processed sequentially, providing a way to manage multiple database requests in an organized manner.

Syntax

[_taskType, _key, _keyField, _index, _value, _function, _call, _netId] call ramdb_db_fnc_addTask

Parameters

Parameter Type Description Default
_taskType String Type of operation to perform (e.g., "hgetall") ""
_key String Name of the stored key ""
_keyField String Field name for hash operations ""
_index Number Index for list operations -1
_value Array, String, Number, or Boolean Value to store (for set operations) []
_function String Name of function to call with the result ""
_call Boolean Whether to call the function directly (true) or spawn (false) false
_netId String NetID of the target to receive the result ""

Return Value

None. The task is added to the queue and processed asynchronously.

Examples

Add a hash table retrieval task:

["hgetall", "", "", -1, [], "ramdb_db_fnc_test"] call ramdb_db_fnc_addTask;

Add a player-specific task that returns data to a specific client:

["hgetallid", getPlayerUID player, "", -1, [], "ramdb_db_fnc_test", false, netId player] remoteExecCall ["ramdb_db_fnc_addTask", 2, false];

Add a list operation task:

["listadd", "playerMessages", "", -1, ["New message content"], ""] call ramdb_db_fnc_addTask;

Notes

  • Tasks are processed in the order they are added to the queue
  • If the queue is not currently being processed, this function will start the processing
  • The task type determines which database operation will be performed
  • This function is particularly useful for scheduling multiple related operations
  • All operations performed through the task queue are logged for debugging
  • ramdb_db_fnc_processQueue: Processes the pending tasks in the queue
  • ramdb_db_fnc_handler: Handles the results of completed database operations
  • ramdb_db_fnc_scheduler: Manages callback responses from the database

Add Task | Handler | Init | Process Queue | Scheduler | Test