Redis cache data structures, data synchronization issues (double deletion policy), cache avalanche, cache penetration, hot cache refactoring, cache invalidation, sentinels, persistence, Redis obsolescence

Familiar with the application scenarios of Redis data structure and high concurrency of Redis cache. For example, cache avalanche, cache penetration.

Five data structures:

String string

Application Scenarios:

1. Single-value cache:

  • set key value
  • get key

Object caching:

  • Set user:1 value(JSON data)

Note: a deposit, after the modification is not convenient, win in the simple

  • mset user:1:name zhuge user:1:balance 1888
  • mget user:1:name user:1:balance

Note: more than one field modification is convenient

Three, distributed lock:

  • Setnx product:10001 true // If 1 is returned, the lock is successfully obtained
  • Setnx product:10001 true// This value has already been set