improve css & svg caching (#1278)

This commit is contained in:
Shuchang Zheng
2024-11-27 14:54:54 -08:00
committed by GitHub
parent c4e6e953ce
commit 008369217b
3 changed files with 48 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
from abc import ABC, abstractmethod
from datetime import timedelta
from typing import Any
from typing import Any, Union
CACHE_EXPIRE_TIME = timedelta(weeks=4)
MAX_CACHE_ITEM = 1000
@@ -8,7 +8,7 @@ MAX_CACHE_ITEM = 1000
class BaseCache(ABC):
@abstractmethod
async def set(self, key: str, value: Any) -> None:
async def set(self, key: str, value: Any, ex: Union[int, timedelta, None] = CACHE_EXPIRE_TIME) -> None:
pass
@abstractmethod