Redix LogoDocumentation

Introduction

Redix Overview

Redix is a complete and powerful Redis wrapper designed specifically for FiveM and RedM servers. With over 80 supported operations, Redix makes using Redis simple and accessible through an intuitive Lua interface.

Why Choose Redix?

High Performance

Data access in microseconds, drastically reducing database load

Easy to Use

Intuitive Lua API, no deep Redis knowledge required

Complete

Support for all major Redis data structures: Keys, Hashes, Lists, Sets, Sorted Sets, JSON

Configurable

Numerous configuration options via convars

Key Features

Redix is designed with the specific needs of FiveM and RedM servers in mind:

  • Character data management: Store and retrieve complex JSON data instantly for character appearance
  • Smart caching: Reduce database queries for inventory, vehicles, and other frequent information
  • Real-time leaderboards: Implement leaderboards and statistics with Sorted Sets
  • Synchronization: Use Pub/Sub for real-time events between resources

Operations

Redix supports a wide range of operations organized by category:

Key-Value

Save, retrieve, delete keys with support for automatic expiration and TTL management.

Hashes

Ideal for objects with multiple fields, such as configurations or entity properties.

Lists

Perfect for queues, histories, and ordered sequences.

Sets

Unordered collections of unique elements, great for tags and relationships.

Sorted Sets

Score-ordered sets, essential for leaderboards and rankings.

Counters

Atomically increment and decrement numeric values.

JSON

Store, manipulate, and query complex JSON documents with Redis Stack.

Pub/Sub

Publish/subscribe messaging system for real-time communication.

Utilities

System operations, ping, info, and custom commands.

Compatibility

  • FiveM for GTA V
  • RedM for Red Dead Redemption 2
  • Framework-agnostic: works with QBCore, ESX, VORP, and any other framework
  • Requires Redis Stack Server

Quick Start

-- Get the Redix interface
local Redix = exports.redix:GetInterface()

-- Save character data
Redix.Save('character:' .. playerId, {
    name = 'John Doe',
    level = 50,
    money = 10000,
    appearance = {
        face = 1,
        hair = 5,
        hairColor = 1
    }
})

-- Retrieve data
Redix.Get('character:' .. playerId, function(err, data)
    if not err and data then
        print('Welcome, ' .. data.name .. '!')
        print('Level: ' .. data.level)
    end
end)

-- Use JSON for complex data
Redix.JSONSet('character:' .. playerId .. ':clothes', '$', {
    hat = {model = 'hat_01', color = 2},
    shirt = {model = 'shirt_23', color = 1}
})

-- Rank players by level
Redix.ZAdd('leaderboard:level', data.level, playerId)
Redix.ZRevRange('leaderboard:level', 0, 9, function(err, topPlayers)
    -- topPlayers contains the top 10 players
end)

Next Steps

Support and Community

  • Complete and always up-to-date documentation
  • Report bugs or request features on GitHub
  • Join the community for support and sharing

Note

Redix is not affiliated with, endorsed by, or supported by Redis Ltd. It is an open-source project that facilitates the use of Redis in FiveM and RedM servers.