Skip to content

Commit 5cd2713

Browse files
authored
Merge pull request #119 from fastly/acf/pass-docs-clarification
2 parents 5dfc9df + cfa8652 commit 5cd2713

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

fsthttp/request.go

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -486,36 +486,44 @@ func (req *Request) constructABIRequest() error {
486486

487487
// CacheOptions control caching behavior for outgoing requests.
488488
type CacheOptions struct {
489-
// Pass controls whether or not the request should be cached at all. By
490-
// default pass is false, which means the request will only reach the
491-
// backend if a cached response is not available. If pass is set to true,
492-
// the request will always be sent directly to the backend.
489+
// Pass controls whether or not to force a request to bypass the cache.
490+
// By default this is false, which means the request will only reach the
491+
// backend if the request is not normally cacheable (such as a POST), or
492+
// if a cached response is not available. If pass is set to true, the
493+
// request will always be sent directly to the backend.
494+
//
495+
// Setting Pass to false does not guarantee that a response will be
496+
// cached for this request, it only allows a caching attempt to be made.
497+
// For example, a `GET` request may appear cacheable, but if the backend
498+
// response contains `cache-control: no-store`, the response will not be
499+
// cached.
493500
//
494501
// Pass is mutually exclusive with all other cache options. Setting any
495-
// other option will force pass to false.
502+
// other option will change Pass to false.
496503
Pass bool
497504

498505
// PCI controls the PCI/HIPAA compliant, non-volatile caching of the
499506
// request. PCI is false by default, which means the request may not be
500507
// PCI/HIPAA compliant. If PCI is set to true, caching will be made
501-
// compliant, and pass will be forced to false.
508+
// compliant, and the request will not be forced to bypass the cache.
502509
//
503510
// https://docs.fastly.com/products/pci-compliant-caching-and-delivery
504511
PCI bool
505512

506513
// TTL represents a Time-to-Live for cached responses to the request, in
507514
// seconds. If greater than zero, it overrides any behavior specified in the
508-
// response headers, and forces pass to false.
515+
// response headers, and the request will not be forced to bypass the cache.
509516
TTL uint32
510517

511518
// StaleWhileRevalidate represents a stale-while-revalidate time for the
512519
// request, in seconds. If greater than zero, it overrides any behavior
513-
// specified in the response headers, and forces pass to false.
520+
// specified in the response headers, and the request will not be forced to
521+
// bypass the cache.
514522
StaleWhileRevalidate uint32
515523

516524
// SurrogateKey represents an explicit surrogate key for the request, which
517525
// will be added to any `Surrogate-Key` response headers received from the
518-
// backend. If nonempty, it forces pass to false.
526+
// backend. If nonempty, the request will not be forced to bypass the cache.
519527
//
520528
// https://docs.fastly.com/en/guides/purging-api-cache-with-surrogate-keys
521529
SurrogateKey string

0 commit comments

Comments
 (0)