Merge pull request #33 from samueldg/enhancement/atomic_setex

Set password value and expiration atomically
This commit is contained in:
Nicholas Charriere 2016-10-24 09:28:45 -07:00 committed by GitHub
commit dc364bb75e

View file

@ -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