"""
Provide caching that stores cache items in volatile memory.
"""
from __future__ import annotations
from collections.abc import MutableMapping, Sequence
from typing import TypeAlias, Generic, Self, cast, TYPE_CHECKING
from typing_extensions import override
from betty.cache import CacheItem, CacheItemValueContraT
from betty.cache._base import _CommonCacheBase, _StaticCacheItem
if TYPE_CHECKING:
from betty.locale import Localizer
_MemoryCacheStore: TypeAlias = MutableMapping[
str,
"CacheItem[CacheItemValueContraT] | None | _MemoryCacheStore[CacheItemValueContraT]",
]
[docs]
class MemoryCache(
_CommonCacheBase[CacheItemValueContraT], Generic[CacheItemValueContraT]
):
"""
Provide a cache that stores cache items in volatile memory.
"""