Answer: D
Option A is incorrect because it would require keeping a tally of user scores in the DynamoDB table and querying the ranking from the source database. Computing the ranking frequently for a large number of concurrent users would be a time-consuming and costly operation.
Option B is incorrect because it would require keeping a tally of user scores in an RDS table and querying the ranking from the source database. Computing the ranking frequently for a large number of concurrent users would be a complex, time consuming and costly operation.
Option C is incorrect because Memcached is a simple memory object caching solution. It is best suited for key-value use cases storing simple objects (e.g. strings). It is not the optimal solution for this scenario.
Option D is CORRECT because Redis provides the native capability for sorted sets which is an ideal solution for complex and compute-intensive data structures such as leaderboards.
Reference:
https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/elasticache-use-cases.html#elasticache-for-redis-use-cases-gaming