Skip to content

Commit dd00cc2

Browse files
committed
add repr info to ValkeyCache
1 parent db090c1 commit dd00cc2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

aiocache/backends/valkey.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ async def _add(self, key, value, ttl=None, _conn=None):
101101
kwargs["expiry"] = ExpirySet(ExpiryType.SEC, ttl)
102102
was_set = await self.client.set(key, value, **kwargs)
103103
if was_set != "OK":
104-
raise ValueError("Key {} already exists, use .set to update the value".format(key))
104+
raise ValueError(
105+
"Key {} already exists, use .set to update the value".format(key)
106+
)
105107
return was_set
106108

107109
async def _exists(self, key, _conn=None):
@@ -245,4 +247,4 @@ def parse_uri_path(cls, path):
245247
return options
246248

247249
def __repr__(self): # pragma: no cover
248-
return "ValkeyCache"
250+
return f"ValkeyCache ({self.client.config.addresses[0].host}:{self.client.config.addresses[0].port})"

0 commit comments

Comments
 (0)