Overview of @anyfu/dict-core capabilities
@anyfu/dict-core is a high-performance utility designed for managing dictionary data requests, specifically for scenarios like backend configuration dictionaries, status enumerations, and option lists. It provides the following core capabilities:
- Request Merging: Automatically merges multiple dictionary requests within a
mergeDelaywindow into a single HTTP request. - LRU Caching: Supports a maximum number of cache entries with Least Recently Used (LRU) eviction.
- Expiration Control: Uses
cacheTimeto manage cache expiration. - SWR Mode: Stale-While-Revalidate; returns old data first while refreshing in the background.
- Fallback/Degradation: Automatically falls back to cached data if a request fails.
- Automatic Retries: Supports failure retries with customizable retry conditions.
- Request Cancellation: Ability to cancel pending or in-flight requests.
- Interceptors: Supports both request and response interceptors.
- Custom Parsing: Allows customization of response structures and dictionary parsing logic.