redis uses the setnx command to create locks. How long should I set the expiration time? How to set the failure time is too short, the method is not finished, the lock is automatically released, then concurrency problems will arise. If you set it for too long, other threads that acquire the lock may have to wait a little longer.
how to deal with this problem when only considering stand-alone redis?