Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c7d1bbb
fix(cache): build async cache clients without a deprecation warning
vishal-bala Sep 3, 2026
13c0047
feat(index): add owns_client for explicit client ownership handover
vishal-bala Sep 3, 2026
8877e4a
fix(migration): read the lazily created client, not the raw property
vishal-bala Sep 3, 2026
5934834
docs(utils): stop promising removal in the next major release
vishal-bala Sep 3, 2026
4558ffe
fix(cache): serialise lazy creation of the async cache client
vishal-bala Sep 3, 2026
c2d54c9
fix(router): let an explicit owns_client survive from_existing
vishal-bala Sep 3, 2026
e42acf5
docs(index): document ownership and correct what the code claims
vishal-bala Sep 3, 2026
0bbc251
refactor(index)!: remove the deprecated connect and set_client methods
vishal-bala Sep 3, 2026
29b4900
refactor(index): address review of the deprecated-client removal
vishal-bala Sep 3, 2026
950afe8
docs(index): restore the client-injection guidance the removal dropped
vishal-bala Sep 3, 2026
d9ad737
test(index): pin what disconnect_sync actually does in a running loop
vishal-bala Sep 3, 2026
0ffaab1
Merge origin/main into refactor/deprecated-client/01-owns-client-and-…
vishal-bala Sep 10, 2026
1bbf996
Merge branch 01 into refactor/deprecated-client/02-remove-index-conne…
vishal-bala Sep 10, 2026
29c37b1
refactor(migration): drop a cast import left dead by the merge
vishal-bala Sep 10, 2026
3de7821
Merge branch 'refactor/deprecated-client/01-owns-client-and-internal-…
vishal-bala Sep 10, 2026
3bc0a1b
Merge remote-tracking branch 'origin/main' into refactor/deprecated-c…
vishal-bala Sep 23, 2026
5c2a658
fix: keep the cache lock loop-local and treat owns_client=None as una…
vishal-bala Sep 23, 2026
ad46213
Merge branch 'refactor/deprecated-client/01-owns-client-and-internal-…
vishal-bala Sep 23, 2026
b620272
Merge remote-tracking branch 'origin/main' into refactor/deprecated-c…
vishal-bala Sep 28, 2026
39e0da2
Merge branch 'refactor/deprecated-client/01-owns-client-and-internal-…
vishal-bala Sep 28, 2026
9396bc8
Merge remote-tracking branch 'origin/main' into refactor/deprecated-c…
vishal-bala Oct 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions redisvl/extensions/cache/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

import asyncio
from typing import Any, cast
from typing import Any, TypedDict

from redis import Redis # For backwards compatibility in type checking
from redis.cluster import RedisCluster
Expand All @@ -19,6 +19,18 @@
CLEAR_BATCH_SIZE = 500


class _CacheConnectionKwargs(TypedDict):
"""The connection parameters a cache keeps for building its clients.

Annotated so each value keeps its own type. Without it the dict literal
widens to the union of all three, and every read needs a cast.
"""

redis_client: SyncRedisClient | None
redis_url: str
connection_kwargs: dict[str, Any]


class BaseCache:
"""Base abstract cache interface for all RedisVL caches.

Expand Down Expand Up @@ -55,7 +67,7 @@ def __init__(
self._ttl: int | None = None
self.set_ttl(ttl)

self.redis_kwargs = {
self.redis_kwargs: _CacheConnectionKwargs = {
"redis_client": redis_client,
"redis_url": redis_url,
"connection_kwargs": connection_kwargs,
Expand Down Expand Up @@ -127,8 +139,8 @@ def _get_redis_client(self) -> SyncRedisClient:
"""
if self._redis_client is None:
# Create new Redis client
url = cast(str | None, self.redis_kwargs["redis_url"])
kwargs = cast(dict[str, Any], self.redis_kwargs["connection_kwargs"])
url = self.redis_kwargs["redis_url"]
kwargs = self.redis_kwargs["connection_kwargs"]
self._redis_client = RedisConnectionFactory.get_redis_connection(
redis_url=url,
**kwargs,
Expand Down Expand Up @@ -170,10 +182,8 @@ async def _get_async_redis_client(self) -> AsyncRedisClient:
if provided and isinstance(provided, (Redis, RedisCluster)):
client = RedisConnectionFactory.sync_to_async_redis(provided)
else:
url = cast(str | None, self.redis_kwargs["redis_url"])
kwargs = cast(
dict[str, Any], self.redis_kwargs["connection_kwargs"]
)
url = self.redis_kwargs["redis_url"]
kwargs = self.redis_kwargs["connection_kwargs"]
client = await RedisConnectionFactory._get_aredis_connection(
redis_url=url, **kwargs
)
Expand Down
5 changes: 1 addition & 4 deletions redisvl/extensions/router/semantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,7 @@ def from_existing(
overwrite = kwargs.pop("overwrite", False)
if not create_index and overwrite:
raise ValueError(CREATE_INDEX_OVERWRITE_CONFLICT)
init_kwargs, connection_kwargs = _split_from_existing_kwargs(
dict(kwargs),
nested_connection_keys=("connection_kwargs",),
)
init_kwargs, connection_kwargs = _split_from_existing_kwargs(dict(kwargs))
lib_name = init_kwargs.get("lib_name")
index_kwargs: dict[str, Any] = {}
created_redis_client = False
Expand Down
Loading
Loading