API ReferenceCounters
Overview
Counter operations allow you to increment and decrement numeric values atomically. These operations are thread-safe and perfect for tracking counts, scores, statistics, and any numeric data that needs to be modified concurrently.
Available Operations
Increment
Atomically increment a numeric value by a specified amount.
Decrement
Atomically decrement a numeric value by a specified amount.
IncrementFloat
Atomically increment a floating-point numeric value.
View IncrementFloat Documentation
Use Cases
Counter operations are ideal for:
- Player Statistics: Track kills, deaths, scores
- Server Metrics: Monitor active players, total connections
- Rate Limiting: Implement request counters with expiration
- Currency Management: Handle virtual currency transactions
- Inventory Counts: Track item quantities
- Achievement Progress: Monitor progress toward goals
Quick Example
local Redix = exports.redix:GetInterface()
-- Track player kills
Redix.Increment('player:123:kills', 1)
-- Add money
Redix.IncrementFloat('player:123:money', 150.50)
-- Decrement lives
Redix.Decrement('player:123:lives', 1)