11 lines
329 B
Python
11 lines
329 B
Python
from typing import Any, Dict, Optional
|
|
|
|
from bson import ObjectId
|
|
from libbot.cache.classes import Cache
|
|
|
|
|
|
def restore_from_cache(
|
|
cache_prefix: str, cache_key: str | int | ObjectId, cache: Optional[Cache] = None
|
|
) -> Dict[str, Any] | None:
|
|
return None if cache is None else cache.get_json(f"{cache_prefix}_{cache_key}")
|