Nexus Core constructs every Redis cache key by combining the addon’s cacheKeyHeaderTag() value with the runtime value of the isId field from the document. Understanding this format lets you inspect or debug the cache directly with redis-cli and helps you design addons that do not interfere with each other.
For example, an addon with cacheKeyHeaderTag() returning "stats" and an isId field value of "Steve" produces the key stats_Steve.
Examples
Cache Entry Format
Each Redis key maps to a serialized JSON string containing the complete document. For example:
Cache entries are automatically invalidated during SET_DATA, UPDATE_DATA, INCREMENT_DATA, and REMOVE_DATA operations.
Avoiding Key Collisions
Two addons using the same cacheKeyHeaderTag() value can overwrite each other’s Redis entries. This causes one addon to read data belonging to a different collection and silently return corrupted results.
To prevent collisions:
- Use a prefix that clearly identifies both the addon and its collection (e.g.
pvp_stats, guild_data, eco_balance).
- Avoid generic prefixes like
stats, data, or player that other addons are likely to also use.
- Maintain a central registry (alongside your addon ID constants) that lists all tags in use.
Inspecting the Cache
You can inspect live cache entries directly with redis-cli: