advancedTop 30 Scenario-Based Questions
Design a real-time leaderboard for a mobile game with 10 million players.
Redis Sorted Set is purpose-built: 1) Update score: ZADD game:global:scores {newScore} '{playerId}'. For increment: ZINCRBY game:global:scores {amount} '{playerId}'. 2) Get top 100: ZREVRANGE game:global:scores 0 99 WITHSCORES. 3) Get player rank: ZREVRANK game:global:scores '{playerId}' (0-based; add 1). 4) Get player score: ZSCORE game:global:scores '{playerId}'. 5) Weekly leaderboard: use separ
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response