create new Database object for SqlCache

This commit is contained in:
Izalia Mae 2024-02-04 04:40:51 -05:00
parent 46413be2af
commit 64690a5c05

View file

@ -9,6 +9,7 @@ from dataclasses import asdict, dataclass
from datetime import datetime, timezone from datetime import datetime, timezone
from redis import Redis from redis import Redis
from .database import get_database
from .misc import Message, boolean from .misc import Message, boolean
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:
@ -141,9 +142,9 @@ class SqlCache(Cache):
name: str = 'database' name: str = 'database'
@property def __init__(self, app: Application):
def _db(self) -> Database: self._db = get_database(app.config)
return self.app.database Cache.__init__(self, app)
def get(self, namespace: str, key: str) -> Item: def get(self, namespace: str, key: str) -> Item: