redis


1. Caching

const redis = require('redis');
const client = redis.createClient();

client.setex('my-key', 300, 'my-value'); // Cache for 5 minutes
client.get('my-key', (err, reply) => {
  if (err) { /* handle error */ }
  console.log(reply); // 'my-value'
});
client.del('my-key'); // Delete the cache

2. Rate Limiting

const redis = require('redis');
const client = redis.createClient();

client.incr('rate-limit:user-a', (err, reply) => {
  if (err) { /* handle error */ }
  if (reply > 10) { // Limit exceeded
    console.log('Rate limit exceeded.');
  }
});

3. Queuing

4. Pub/Sub

5. Session Management

6. Geospatial Queries

7. HyperLogLog

8. Time Series

9. Graph

10. Search

11. Aggregate Queries

12. Multi-Database

13. Cluster

14. Sentinel

15. Pub/Sub with Pattern Matching

16. Lua Scripting

17. Slowlog

18. Config

19. Monitor

20. Pipeline

21. Multi

22. Watch

23. Sort

24. Scan

25. TTL