-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
There was an attempt at solving this in #1531, but it has some edge cases. For example:
>>> import redis
>>> r = redis.Redis()
>>> r.set('a', 'b')
True
>>> r.getex('a', ex=1000, px=1000)
b'b'
>>> r.ttl('a')
996The call to getex() doesn't fail because extract_expire_flags() will use the first option that is not None.
It throws the exception only when the option values are unique:
>>> r.getex('a', ex=2, px=1000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".venv/lib/python3.12/site-packages/redis/commands/core.py", line 1879, in getex
"``ex``, ``px``, ``exat``, ``pxat``, "
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
redis.exceptions.DataError: ``ex``, ``px``, ``exat``, ``pxat``, and ``persist`` are mutually exclusive.Metadata
Metadata
Assignees
Labels
No labels