ChemPal Documentation - v1.6.0
    Preparing search index...

    Function getSupplierProductDataCacheEntry

    • Reads one entry from the supplier product data cache, which holds per-product detail fetched lazily after a search.

      Parameters

      • cacheKey: string

        The product-level cache key.

      Returns Promise<undefined | CachedProductEntry>

      The cached product data and its timestamp, or undefined on a miss.

      const entry = await getSupplierProductDataCacheEntry("Loudwolf|SKU-1");
      entry?.timestamp; // => 1712345678901
      export async function getSupplierProductDataCacheEntry(
      cacheKey: string,
      ): Promise<CachedProductEntry | undefined> {
      try {
      const db = await getDB();
      const record = await db.get(IDB_STORE.SUPPLIER_PRODUCT_DATA_CACHE, cacheKey);
      if (!record) return undefined;
      return {
      data: record.data,
      timestamp: record.timestamp,
      };
      } catch (error) {
      logger.error('Failed to get supplier product data cache entry from IndexedDB', { error });
      return undefined;
      }
      }