Generates a cache key based on the query and supplier name. The limit is intentionally excluded as it only affects how many results are returned, not the actual search results themselves.
Generates a cache key for product detail data based only on the HTTP request URL and params. This ensures that identical detail requests (even from different queries) share the same cache entry.
Optional
params: Record<string, string>Static
getGets the query cache key used in storage.
Static
getGets the product data cache key used in storage.
Private
Static
Readonly
queryPrivate
Static
Readonly
productPrivate
Static
Readonly
CACHE_Private
Static
Readonly
cachePrivate
Static
Readonly
productPrivate
logger
Utility class for managing supplier data caching in Chrome's local storage. Provides a robust caching system for both query results and product detail data.
Remarks
Benefits of this Caching Approach:
Granular Data Reuse:
Flexible Result Limits:
Storage Efficiency:
Improved Performance:
Better Cache Invalidation:
Optimized Network Usage:
The cache system uses two separate storage keys:
supplier_query_cache
- Stores search query resultssupplier_product_data_cache
- Stores detailed product dataCache Storage Format:
Query Cache:
Product Data Cache:
Cache Key Generation:
${query}:${supplierName}
Falls back to a simple hash if base64 is unavailableCache Expiration & Management:
CACHE_VERSION
constant)Cache Triggering: The cache is automatically triggered in two main scenarios:
Query Results Caching (via
queryProductsWithCache
):Product Data Caching (via
getProductData
):Cache Flow:
Query Results:
Product Data:
ProductBuilder.dump()
)Usage Example:
Type Param: T
The type of data being cached