SETTINGS.cache_seconds
This commit is contained in:
parent
c903144657
commit
20a32d82d6
3 changed files with 6 additions and 3 deletions
|
@ -11,6 +11,7 @@ from vobject.icalendar import VEvent
|
||||||
|
|
||||||
from .async_helpers import get_ttl_hash, run_in_executor, timed_alru_cache
|
from .async_helpers import get_ttl_hash, run_in_executor, timed_alru_cache
|
||||||
from .dav_common import caldav_principal
|
from .dav_common import caldav_principal
|
||||||
|
from .settings import SETTINGS
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -123,13 +124,13 @@ class DavCalendar:
|
||||||
@property
|
@property
|
||||||
async def calendar(self) -> Calendar:
|
async def calendar(self) -> Calendar:
|
||||||
return await _get_calendar(
|
return await _get_calendar(
|
||||||
ttl_hash=get_ttl_hash(20),
|
ttl_hash=get_ttl_hash(SETTINGS.cache_seconds),
|
||||||
calendar_name=self.calendar_name,
|
calendar_name=self.calendar_name,
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
async def events(self) -> list[CalEvent]:
|
async def events(self) -> list[CalEvent]:
|
||||||
return await _get_calendar_events(
|
return await _get_calendar_events(
|
||||||
ttl_hash=get_ttl_hash(20),
|
ttl_hash=get_ttl_hash(SETTINGS.cache_seconds),
|
||||||
calendar_name=self.calendar_name,
|
calendar_name=self.calendar_name,
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,6 +7,7 @@ from webdav3.client import Resource
|
||||||
|
|
||||||
from .async_helpers import get_ttl_hash, run_in_executor, timed_alru_cache
|
from .async_helpers import get_ttl_hash, run_in_executor, timed_alru_cache
|
||||||
from .dav_common import webdav_resource
|
from .dav_common import webdav_resource
|
||||||
|
from .settings import SETTINGS
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -34,7 +35,7 @@ class DavFile:
|
||||||
@property
|
@property
|
||||||
async def __buffer(self) -> BytesIO:
|
async def __buffer(self) -> BytesIO:
|
||||||
return await _get_buffer(
|
return await _get_buffer(
|
||||||
ttl_hash=get_ttl_hash(20),
|
ttl_hash=get_ttl_hash(SETTINGS.cache_seconds),
|
||||||
remote_path=self.remote_path,
|
remote_path=self.remote_path,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ class Settings(BaseSettings):
|
||||||
dav_path: str = "ovdashboard"
|
dav_path: str = "ovdashboard"
|
||||||
|
|
||||||
ticker_separator: str = " +++ "
|
ticker_separator: str = " +++ "
|
||||||
|
cache_seconds: int = 30
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def caldav_url(self) -> str:
|
def caldav_url(self) -> str:
|
||||||
|
|
Loading…
Reference in a new issue