Redix LogoDocumentation
API ReferenceUtilities

FlushDB

Delete all keys in the current database

Syntax

Redix.FlushDB()

Parameters

Prop

Type

Returns

Prop

Type

Example

-- Clear entire database
Redix.FlushDB()
print('All Redis keys deleted')

DESTRUCTIVE OPERATION: This will delete ALL keys in the current Redis database. Use with extreme caution, especially in production environments.

Use Cases

Development/Testing

-- Clear test data
if GetConvar('environment', 'production') == 'development' then
    Redix.FlushDB()
    print('Test data cleared')
else
    print('Cannot flush database in production!')
end

Reset Command

RegisterCommand('redis:reset', function(source, args, rawCommand)
    if IsPlayerAceAllowed(source, 'admin') then
        Redix.FlushDB()
        print('^1[Admin] Redis database cleared^7')
    else
        print('Insufficient permissions')
    end
end, true)