@@ -179,7 +179,7 @@ def __init__(self, config: GrpcConfig):
179179 self ._stubs_async_map : dict [asyncio .AbstractEventLoop , dict [type [Any ], Any ]] = {}
180180
181181 # Initialize cache if caching is enabled
182- self ._cache = self ._init_cache ()
182+ self .cache = self ._init_cache ()
183183
184184 # default loop for sync API
185185 self ._default_loop = asyncio .new_event_loop ()
@@ -224,6 +224,10 @@ def _init_cache(self) -> GrpcCache | None:
224224 logger .warning (f"Failed to initialize cache: { e } " )
225225 return None
226226
227+ @property
228+ def has_cache (self ):
229+ return self .cache is not None
230+
227231 @property
228232 def default_loop (self ) -> asyncio .AbstractEventLoop :
229233 """Return the default event loop used for synchronous API operations.
@@ -246,7 +250,7 @@ def get_stub(self, stub_class: type[Any]) -> Any:
246250
247251 if loop not in self ._channels_async :
248252 channel = use_sift_async_channel (
249- self ._config ._to_sift_channel_config (), self ._config .metadata , self ._cache
253+ self ._config ._to_sift_channel_config (), self ._config .metadata , self .cache
250254 )
251255 self ._channels_async [loop ] = channel
252256 self ._stubs_async_map [loop ] = {}
@@ -289,4 +293,4 @@ async def _create_async_channel(
289293 self , cfg : SiftChannelConfig , metadata : dict [str , str ] | None
290294 ) -> Any :
291295 """Helper to create async channel on default loop."""
292- return use_sift_async_channel (cfg , metadata , self ._cache )
296+ return use_sift_async_channel (cfg , metadata , self .cache )
0 commit comments