asphalt.redis.component
- class asphalt.redis.component.RedisComponent(*, resource_name='default', validate_connection=True, **kwargs)
Bases:
Component
Provides a
redis.asyncio.Redis
client as a resource.- Parameters:
- async start(ctx)
Perform any necessary tasks to start the services provided by this component.
- In this method, components typically use the context to:
add resources and/or resource factories to it (
add_resource()
andadd_resource_factory()
)request resources from it asynchronously (
request_resource()
)
It is advisable for Components to first add all the resources they can to the context before requesting any from it. This will speed up the dependency resolution and prevent deadlocks.
- Parameters:
ctx (Context) – the containing context for this component
- Return type:
AsyncGenerator[None, Exception | None]