diff --git a/pkg/types/gateway/action.go b/pkg/types/gateway/action.go index 63ab108ace..c86b69ad38 100644 --- a/pkg/types/gateway/action.go +++ b/pkg/types/gateway/action.go @@ -15,8 +15,10 @@ const ( // CacheSettings defines cache control options for outbound HTTP requests. type CacheSettings struct { - ReadFromCache bool `json:"readFromCache,omitempty"` // If true, attempt to read a cached response for the request - MaxAgeMs int32 `json:"maxAgeMs,omitempty"` // Maximum age of a cached response in milliseconds. + MaxAgeMs int32 `json:"maxAgeMs,omitempty"` // Maximum age of a cached response in milliseconds. + Store bool `json:"store,omitempty"` // If true, cache the response. + // Deprecated: positive MaxAgeMs implies ReadFromCache is true + ReadFromCache bool `json:"readFromCache,omitempty"` // If true, attempt to read a cached response for the request } // OutboundHTTPRequest represents an HTTP request to be sent from workflow node to the gateway. @@ -31,13 +33,16 @@ type OutboundHTTPRequest struct { // Maximum number of bytes to read from the response body. If the gateway max response size is smaller than this value, the gateway max response size will be used. MaxResponseBytes uint32 `json:"maxBytes,omitempty"` WorkflowID string `json:"workflowId"` + WorkflowOwner string `json:"workflowOwner"` } +// Hash generates a hash of the request for caching purposes. +// WorkflowID is not included in the hash because cached responses can be used across workflows func (req OutboundHTTPRequest) Hash() string { s := sha256.New() sep := []byte("/") - s.Write([]byte(req.WorkflowID)) + s.Write([]byte(req.WorkflowOwner)) s.Write(sep) s.Write([]byte(req.URL)) s.Write(sep)