ayaka.depend.cache
群组缓存
1'''群组缓存''' 2from typing import TYPE_CHECKING 3from .depend import AyakaDepend 4from ..config import ayaka_root_config 5 6if TYPE_CHECKING: 7 from ..ayaka import AyakaApp 8 9 10class AyakaCache(AyakaDepend): 11 '''Ayaka缓存 以群组为单位相互独立''' 12 class Config: 13 arbitrary_types_allowed = True 14 15 @classmethod 16 async def _create_by_app(cls, app: "AyakaApp"): 17 cache = app.cache 18 name = cls.__name__ 19 if name not in cache: 20 if ayaka_root_config.debug: 21 print(f"初始化缓存 {cls.__name__}") 22 cache[name] = cls() 23 return cache[name]
11class AyakaCache(AyakaDepend): 12 '''Ayaka缓存 以群组为单位相互独立''' 13 class Config: 14 arbitrary_types_allowed = True 15 16 @classmethod 17 async def _create_by_app(cls, app: "AyakaApp"): 18 cache = app.cache 19 name = cls.__name__ 20 if name not in cache: 21 if ayaka_root_config.debug: 22 print(f"初始化缓存 {cls.__name__}") 23 cache[name] = cls() 24 return cache[name]
Ayaka缓存 以群组为单位相互独立
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
class
AyakaCache.Config: