Skip to content

Commit

Permalink
Update redis.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer committed Dec 27, 2022
1 parent 4a75e53 commit 6d064d3
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions aiocache/backends/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,10 @@ async def _set(self, key, value, ttl=None, _cas_token=None, _conn=None):
return await self.client.setex(key, ttl, value)

async def _cas(self, key, value, token, ttl=None, _conn=None):
args = [key, value, token]
args = ()
if ttl is not None:
if isinstance(ttl, float):
args += ["PX", int(ttl * 1000)]
else:
args += ["EX", ttl]
res = await self._raw("eval", self.CAS_SCRIPT, 1, *args, _conn=_conn)
return res
args = ("PX", int(ttl * 1000)) if isinstance(ttl, float) else ("EX", ttl)
return await self._raw("eval", self.CAS_SCRIPT, 1, key, value, token, *args, _conn=_conn)

async def _multi_set(self, pairs, ttl=None, _conn=None):
ttl = ttl or 0
Expand Down

0 comments on commit 6d064d3

Please sign in to comment.