feat: cache impl done

This commit is contained in:
Relakkes
2024-06-02 19:57:13 +08:00
parent 6c4116f240
commit 4bba1447f8
16 changed files with 180 additions and 43 deletions

13
cache/abs_cache.py vendored
View File

@@ -5,10 +5,10 @@
# @Desc : 抽象类
from abc import ABC, abstractmethod
from typing import Any, Optional
from typing import Any, List, Optional
class Cache(ABC):
class AbstractCache(ABC):
@abstractmethod
def get(self, key: str) -> Optional[Any]:
@@ -31,3 +31,12 @@ class Cache(ABC):
:return:
"""
raise NotImplementedError
@abstractmethod
def keys(self, pattern: str) -> List[str]:
"""
获取所有符合pattern的key
:param pattern: 匹配模式
:return:
"""
raise NotImplementedError