data-api-builder icon indicating copy to clipboard operation
data-api-builder copied to clipboard

Add header support for caching

Open aaronburtle opened this issue 9 months ago • 14 comments

Why make this change?

Closes https://github.com/Azure/data-api-builder/issues/2604

What is this change?

Inside of the SqlQueryStructure, there is a private constructor, that all of the public constructors will call. This private constructor offers a single point where all of the queries will bottleneck, and therefore we add the cache control information to the query structure at this point. Then when we are in the SqlQueryEngine, we can check for this cache control information and handle the query appropriately.

The cache control options can be found

here: https://github.com/Azure/data-api-builder/issues/2253

and here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control#request_directives

But for reference, they are no-cache, no-store, only-if-cached, which will mean we do not get from the cache, we do not store in the cache, and if there is a cache miss we return gateway timeout, respectively.

How was this tested?

Run against test suite.

Sample Request(s)

To test you need to include the relevant cache headers in the request, "no-cache", "no-store", or "only-if-cached"

aaronburtle avatar Apr 14 '25 15:04 aaronburtle

/azp run

aaronburtle avatar Apr 15 '25 22:04 aaronburtle

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Apr 15 '25 22:04 azure-pipelines[bot]

/azp run

aaronburtle avatar Apr 16 '25 15:04 aaronburtle

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Apr 16 '25 15:04 azure-pipelines[bot]

/azp run

aaronburtle avatar Apr 16 '25 16:04 aaronburtle

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Apr 16 '25 16:04 azure-pipelines[bot]

/azp run

aaronburtle avatar Apr 16 '25 18:04 aaronburtle

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Apr 16 '25 18:04 azure-pipelines[bot]

/azp run

aaronburtle avatar Apr 16 '25 18:04 aaronburtle

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Apr 16 '25 18:04 azure-pipelines[bot]

/azp run

aaronburtle avatar Apr 16 '25 19:04 aaronburtle

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Apr 16 '25 19:04 azure-pipelines[bot]

/azp run

aaronburtle avatar Apr 18 '25 06:04 aaronburtle

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar Apr 18 '25 06:04 azure-pipelines[bot]

/azp run

aaronburtle avatar May 22 '25 06:05 aaronburtle

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

azure-pipelines[bot] avatar May 22 '25 06:05 azure-pipelines[bot]

/azp run

aaronburtle avatar May 22 '25 06:05 aaronburtle

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar May 22 '25 06:05 azure-pipelines[bot]

/azp run

aaronburtle avatar May 22 '25 22:05 aaronburtle

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar May 22 '25 22:05 azure-pipelines[bot]

/azp run

aaronburtle avatar May 22 '25 23:05 aaronburtle

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar May 22 '25 23:05 azure-pipelines[bot]

/azp run

aaronburtle avatar May 23 '25 04:05 aaronburtle

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar May 23 '25 04:05 azure-pipelines[bot]

/azp run

aaronburtle avatar May 23 '25 07:05 aaronburtle

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar May 23 '25 07:05 azure-pipelines[bot]

/azp run

aaronburtle avatar May 23 '25 07:05 aaronburtle

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar May 23 '25 07:05 azure-pipelines[bot]

/azp run

aaronburtle avatar May 23 '25 07:05 aaronburtle

Azure Pipelines successfully started running 6 pipeline(s).

azure-pipelines[bot] avatar May 23 '25 07:05 azure-pipelines[bot]