Closed wasperen closed 2 months ago
This PR does this https://github.com/sopherapps/pydantic-redis/pull/30
We need the library to be straight forward. Adding two ways of initializing the Store needs to be last resort. For now, just extend the Store
class MyStore(AbstractStore): # or MyStore(syncio.Store): or or MyStore(asyncio.Store) """My custom store"""
def __init__(
self, name: str, redis_config: RedisConfig, redis_store: Redis, **data: Any
):
self._redis_store = redis_store
super().__init__(name, redis_config, **data)
def _connect_to_redis(self) -> redis.Redis:
"""Connects the store to redis.
See base class.
"""
return self._redis_store
store = MyStore( name="foobar", redis_config=RedisConfig(), redis_store=your_redis_instance )
Please create a new issue of type "Feature request" for us to weigh our options. The merged PR fixes the original issue sufficiently.
Originally posted by @Tinitto in https://github.com/sopherapps/pydantic-redis/issues/35#issuecomment-2211297650