mirror of
https://github.com/NanmiCoder/MediaCrawler.git
synced 2026-02-25 17:40:51 +08:00
feat: cache impl done
This commit is contained in:
13
cache/abs_cache.py
vendored
13
cache/abs_cache.py
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user