Scenario: Using the Estimated Delivery Dates cache

As an owner of an eCommerce platform, you want to ensure a fast and seamless experience for shoppers by reusing the cached EDD results on high -traffic pages, such as the Product List Page (PLP).

Before you use the Estimated Delivery Date (EDD) cache, you must enable caching. For more information, see Configuring caching for Estimated Delivery Dates.

Scenario 1: Reusing the cached EDD results on the PLP

In this scenario, a customer who is located at a specific postal code in the US, opens a PLP to search for an item, such as a pair of shoes. When the item is selected, the Product Details Page (PDP) opens and it uses the Get EDD API to trigger a real-time EDD calculation for the ship or the pickup delivery method. The EDD result is stored in the cache. Subsequently, when a customer views a PLP listing, the same result shows as the getCachedEDDs API retrieves the cached result for the shoes. There is no need to recalculate the EDD to display in the PLP listing for the shoes, saving time and improving performance.

  1. To calculate the EDD on the PDP in Sterling Intelligent Promising, use the Get EDD API to provide the following information:
    
    {
        "customerType": "GOLD",
        "enterpriseCode": "ENT1",
        "shippingGroupId": "2DShipping",
        "destination": {
            "format": "ADDRESS",
            "value": {
                "countryCode": "US",
                "postalCode": "54321",
            }
        },
        "capacityUomToConsider": "UNITS",
        "itemInfo": {
            "itemId": "I1",
            "unitOfMeasure": "EACH",
            "productClass": "CLASS1"
        },
        "capacityCategoriesToConsider": {
            "categoryIds": ["cat1"]
        }
    }
    

    This API call computes the delivery date and stores it in the cache.

  2. To retrieve the cached value on the PLP, the same item and destination information is provided again to the getCachedEDDs API:
    
        "destination": {
            "format": "ADDRESS",
            "value": {
                "countryCode": "US",
                "postalCode": "54321",
            }
        },
        "shippingGroupId": "2DShipping",
        "inputs": [
            {
                "inputId": "I1 input",
                "customerType": "GOLD",
                "enterpriseCode": "ENT1",
                "capacityUomToConsider": "UNITS",
                "itemInfo": {
                    "itemId": "I1",
                    "unitOfMeasure": "EACH",
                    "productClass": "CLASS1"
                },
                "capacityCategoriesToConsider": {
                    "categoryIds": ["cat1"]
                }
            }
        ]
    }
    
    Note: To fetch the previously computed result from the cache, there is a minor change in the structure. This structure change accommodates multiple items in a single API call.
  3. The getCachedEDDs API handles the cached results in the following way:
    • For a cache hit, when a matching cached entry exists, the API returns a trimmed version of the original EDD calculation without triggering a new computation.
    • For a cache miss, if no cached entry is found, the API returns a cacheMiss response.
      • It does not perform a real-time calculation immediately.
      • Instead, it tracks the input and triggers an asynchronous backend job to compute the EDD for the input that is provided. For more information, see the scenario that follows.
      • Future calls with the same input will return the newly cached result.

Scenario 2: Handling cache misses with the asynchronous EDD computation

In this scenario, a shopper views a PLP that includes two items:
  • Item I1: Already computed and cached.
  • Item I2: Cached record does not exist.
When the getCachedEDDs API is called with both items, Sterling Intelligent Promising returns a cache hit for item I1 and a cache miss for item I2. Then, the EDD for item I2 is computed asynchronously in the background, making it available for future requests.
  1. Consider the following sample request to the getCachedEDDs API:
    
    
    {
      "destination": {
        "format": "ADDRESS",
        "value": {
          "countryCode": "US",
          "postalCode": "54321"
        }
      },
      "shippingGroupId": "2DShipping",
      "inputs": [
        {
          "inputId": "I1 input",
          "customerType": "GOLD",
          "enterpriseCode": "ENT1",
          "capacityUomToConsider": "UNITS",
          "itemInfo": {
            "itemId": "Shoes",
            "unitOfMeasure": "EACH",
            "productClass": "CLASS1"
          },
          "capacityCategoriesToConsider": {
            "categoryIds": ["cat1"]
          }
        },
        {
          "inputId": "I2 input",
          "enterpriseCode": "ENT1",
          "capacityUomToConsider": "UNITS",
          "itemInfo": {
            "itemId": "I2",
            "unitOfMeasure": "EACH",
            "productClass": "CLASS1"
          },
          "capacityCategoriesToConsider": {
            "categoryIds": ["cat1"]
          }
        }
      ]
    }
    
    To retrieve EDDs from the cache, use the getCachedEDDs API. If the requested item was not calculated previously, the API returns a cacheMiss and Sterling Intelligent Promising computes the EDD asynchronously and caches the result for future use.
  2. The following response is returned:
    {
      "outputs": [
        {
          "inputId": "I1 input",
          "cacheHit": [
            {
              "resultFound": true,
              "result": {
                "deliveryTime": "2025-09-09T02:30:00.000Z",
                "placeOrderBy": "2025-09-08T22:30:00.000Z"
              }
            }
          ]
        },
        {
          "inputId": "I2 input",
          "cacheMiss": true
        }
      ]
    }
    

The previous cached result is returned for item I1 but a cacheMiss: true is returned for item I2.

Now, Sterling Intelligent Promising pre-computes the EDD for item I2 asynchronously by using a backend job and eventually the same input returns to the getCachedEDDs API, as shown in the following example:
{
    "outputs": [
        {
            "inputId": "I1 input",
            "cacheHit": [
                {
                    "resultFound": true,
                    "result": {
                        "deliveryTime": "2025-09-09T02:30:00.000Z",
                        "placeOrderBy": "2025-09-08T22:30:00.000Z"
                    }
                }
            ]
        },
        {
            "inputId": "I2 input",
            "cacheHit": [
                {
                    "resultFound": true,
                    "result": {
                        "deliveryTime": "2025-09-13T02:30:00.000Z",
                        "placeOrderBy": "2025-09-08T22:30:00.000Z"
                    }
                }
            ]
        }
    ]
}