Merge pull request #33 from samueldg/enhancement/atomic_setex
Set password value and expiration atomically
This commit is contained in:
commit
dc364bb75e
1 changed files with 1 additions and 2 deletions
|
@ -48,8 +48,7 @@ def check_redis_alive(fn):
|
||||||
@check_redis_alive
|
@check_redis_alive
|
||||||
def set_password(password, ttl):
|
def set_password(password, ttl):
|
||||||
key = uuid.uuid4().hex
|
key = uuid.uuid4().hex
|
||||||
redis_client.set(key, password)
|
redis_client.setex(key, ttl, password)
|
||||||
redis_client.expire(key, ttl)
|
|
||||||
return key
|
return key
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue