mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-22 06:27:59 +00:00
create new Database object for SqlCache
This commit is contained in:
parent
46413be2af
commit
64690a5c05
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue