Skip to content

Commit 2aa4cd6

Browse files
committed
Add cache control fields
1 parent 94ac6f1 commit 2aa4cd6

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

htsget.md

+31-1
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,22 @@ For file formats whose specification describes a header and a body, the class in
524524
Either all or none of the URLs in the response MUST have a class attribute.
525525
If `class` fields are not supplied, no assumptions can be made about which data blocks contain headers, body records, or parts of both.
526526
</td></tr>
527+
<tr markdown="block"><td>
528+
529+
`ETag`
530+
_optional string_
531+
</td><td>
532+
533+
The _entity-tag_ that would be returned to a request for the URL.
534+
</td></tr>
535+
<tr markdown="block"><td>
536+
537+
`Last-Modified`
538+
_optional string_
539+
</td><td>
540+
541+
The last modification _HTTP-date_ that would be returned to a request for the URL.
542+
</td></tr>
527543
</table>
528544

529545
</td></tr>
@@ -588,7 +604,7 @@ An example of a JSON response is:
588604
While the blocks must be finally concatenated in the given order, the client may fetch them in parallel and/or reuse cached data from URLs that have previously been downloaded.
589605

590606
When making a series of requests to fetch reads or variants within different regions of the same `<id>` resource, clients may wish to avoid re-fetching the SAM/CRAM/VCF headers each time, especially if they are large.
591-
If the ticket contains `class` fields, the client may reuse previously downloaded and parsed headers rather than re-fetching the `header`-class URLs.
607+
If the ticket contains `class` fields and/or cache control fields, the client may reuse previously downloaded and parsed headers rather than re-fetching the `header`-class URLs, as described below.
592608

593609
### HTTPS data block URLs
594610

@@ -613,6 +629,20 @@ The client obtains the data block by decoding the embedded base64 payload.
613629

614630
Note: the base64 text should not be additionally percent encoded.
615631

632+
### Avoiding re-fetching ticket array URLs
633+
634+
Clients may use `class` fields and the usual HTTP cache control mechanisms to avoid re-fetching URLs in the ticket array whose contents the client has already downloaded.
635+
For example, when making multiple requests to fetch reads (or variants) within different regions of the same `<id>` resource, usually the SAM/CRAM (or VCF) headers will not change between requests.
636+
When the headers are large and the requested regions are small, the headers will constitute most of the downloaded data and it will be advantageous to avoid re-fetching this unchanged data.
637+
638+
If classes are specified in the ticket, zero or more of the entries at the start of the `urls` array will have class `header`.
639+
When the client has previously downloaded the resource's SAM/VCF headers, it may reuse these known headers rather than re-fetching the `header`-class URLs.
640+
(The boundary between the contents of the final `header` URL and the first `body` URL must be at the start of the first data record, as described in FIXME FOOTNOTE FOR BAM/CRAM/VCF/BCF.
641+
If the resource is BGZF-compressed, the end of the contents of the final `header` URL must be the end of a BGZF block.)
642+
643+
Clients SHOULD use the usual HTTP caching facilities (`Cache-Control`; `ETag`/`If-None-Match` and/or `Last-Modified`/`If-Modified-Since`) to ensure that reused cached data is still valid.
644+
If the server has provided `ETag` or `Last-Modified` ticket fields for a particular URL, the client can use them to avoid making even a request/304 round trip for that URL.
645+
616646
### Reliability & performance considerations
617647

618648
To provide robustness to sporadic transfer failures, servers should divide large payloads into multiple data blocks in the `urls` array. Then if the transfer of any one block fails, the client can retry that block and carry on, instead of starting all over. Clients may also fetch blocks in parallel, which can improve throughput.

0 commit comments

Comments
 (0)