Cache
Library
Updated a month ago ·
v1.3.7dirk_lib keeps a client-side cache for frequently accessed values and emits change events when values update.
Accessing Cache
cache.<key>
lib.cache(key)
lib.onCache(key, cb)
Registers a change listener and immediately invokes the callback with the current value.
Equivalent low-level event:
Cache Keys (Client)
| Key | Type | Description |
|---|---|---|
resource | string | Current resource name |
game | string | Game name (fivem / redm) |
playerId | number | Result of PlayerId() |
serverId | number | Current player server ID |
ped | number | Current player ped entity |
vehicle | number | false | Vehicle entity if in vehicle; otherwise false |
seat | number | false | Current seat index; otherwise false |
driver | boolean | true when seat is -1 |
weapon | number | false | Current weapon hash when armed; otherwise false |
mount | number | false | RedM only: current mount entity or false |
dead | boolean | Framework/game state death flag |
cuffed | boolean | nil | Framework-specific cuff state |
job | table | Parsed framework job object (see formats below) |
gang | table | nil | QB/QBX gang payload |
citizenId | string | nil | Character identifier (citizenid or identifier) |
charName | string | nil | Character full name |
playerLoaded | boolean | Whether character/player has loaded |
!
cache.playerData is not a cache key in current dirk_lib source.
Job Object Format
The job cache shape is built in framework cache adapters (not from dirk_lib/types/job).
QB / QBX job shape
ESX job shape
Logged-out QB/QBX fallback
On player unload, job is set to:
Framework-Dependent Notes
dead,cuffed,job,citizenId,charName, andplayerLoadedare framework-populated.gangis currently populated in QB/QBX adapters.mountis populated only on RedM.
Change Semantics
Cache writes use deep comparison for tables and emit dirk_lib:cache:<key> only when values actually change.
Was this page helpful?
This page was last updated on 12 March 2026