Distributed lock: concurrent operation reduces inventory
Single-machine thread safety lock:
database realizes distributed lock:
redis realizes distributed lock:
redis distributed lock deadlock problem: if an exception occurs during program execution and the redis key is not deleted, a deadlock problem
solution will occur . Add expiration time to key