LookupOptions

Structin corecompute-sdk-go v1.11.0View source
1
2
3
4
5
6
7
8
9
type LookupOptions struct {
RequestHeaders fsthttp.Header
From uint64
To uint64
LegacyReturnWholeBody bool
}

LookupOptions control the behavior of cache lookups and the objects returned.

Fields

RequestHeaders

fsthttp.Header

RequestHeaders are a set of HTTP headers that influence cache lookups when Vary rules are set.

A lookup will succeed when there is at least one cached object that matches the lookup's cache key, and all of the headers included in the cached object's Vary list match the corresponding headers in that cached object.

From

uint64

From indicates the starting offset to read from the cached object.

To

uint64

To indicates the ending offset to read from the cached object. A value of 0 means to read to the end of the object.

LegacyReturnWholeBody

bool

LegacyReturnWholeBody restores a legacy behavior around range requests.

In SDK v1.4.2 and earlier, under certain circumstances the requested range (From/To) would be ignored. Specifically, if:

  • The lookup (reader) is concurrent with the writer of the body
  • The size of the cached item's body was not provided by the writer
  • The reader requests a specific range of the cached item's body (From and To are provided in LookupOptions or GetBodyOptions) then the core cache API would ignore the requested range and provide the entire body, instead of providing just the requested range.

In SDK v1.4.3, the default behavior changed. In a concurrent read/write:

  • If From and To are nonzero, the reader will block until the start of the requested range has been provided by the writer.
  • Only the requested range will be returned to the reader.

Note that the full body is still provided if the range is invalid.

LegacyReturnWholeBody restores the v1.4.2 behavior.