SETTINGS.cache_size
This commit is contained in:
parent
d09fe0f0e2
commit
f99e45c7bb
4 changed files with 5 additions and 4 deletions
|
@ -94,7 +94,7 @@ class CalEvent(BaseModel):
|
|||
return cls.parse_obj(data)
|
||||
|
||||
|
||||
@timed_alru_cache(maxsize=20)
|
||||
@timed_alru_cache(maxsize=SETTINGS.cache_size)
|
||||
async def _get_calendar(
|
||||
calendar_name: str,
|
||||
) -> Calendar:
|
||||
|
@ -109,7 +109,7 @@ async def _get_calendar(
|
|||
return await _inner()
|
||||
|
||||
|
||||
@timed_alru_cache(maxsize=20)
|
||||
@timed_alru_cache(maxsize=SETTINGS.cache_size)
|
||||
async def _get_calendar_events(
|
||||
calendar_name: str,
|
||||
) -> list[CalEvent]:
|
||||
|
|
|
@ -20,7 +20,7 @@ _WEBDAV_CLIENT = WebDAVclient({
|
|||
})
|
||||
|
||||
|
||||
@lru_cache
|
||||
@lru_cache(maxsize=SETTINGS.cache_size)
|
||||
def webdav_resource(remote_path: Any) -> WebDAVResource:
|
||||
"""
|
||||
Gets a resource using the main WebDAV client.
|
||||
|
|
|
@ -18,7 +18,7 @@ from .settings import SETTINGS
|
|||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@timed_alru_cache(maxsize=20)
|
||||
@timed_alru_cache(maxsize=SETTINGS.cache_size)
|
||||
async def _get_buffer(
|
||||
remote_path: Any,
|
||||
) -> BytesIO:
|
||||
|
|
|
@ -58,6 +58,7 @@ class Settings(BaseSettings):
|
|||
caldav: DavSettings = DavSettings()
|
||||
|
||||
cache_seconds: int = 30
|
||||
cache_size: int = 30
|
||||
|
||||
class Config:
|
||||
env_nested_delimiter = "__"
|
||||
|
|
Loading…
Reference in a new issue