Skip to content

Conversation

@cpeel
Copy link
Member

@cpeel cpeel commented Dec 26, 2025

Allow the browser to cache some API responses for endpoints that change very very rarely. These in particular are used by the new PI and letting the browser cache them for a bit will make the initial PI load faster when users are coming in and out of the PI (the PI doesn't reload these when it moves between pages).

We cache the site documents and dictionaries for a day. Project pickersets for an hour.

Sandbox: https://www.pgdp.org/~cpeel/c.branch/cache-some-api-responses/

Testing is making sure the Cache-Control header is included in the response, eg:

export API_KEY=review
curl -i -H "Accept: application/json" -H "X-API-KEY: $API_KEY" \
    -X GET "https://www.pgdp.org/~cpeel/c.branch/cache-some-api-responses/api/v1/documents"

@cpeel cpeel requested review from 70ray and srjfoo December 26, 2025 19:16
@cpeel cpeel self-assigned this Dec 26, 2025
@cpeel cpeel merged commit 6077c2a into DistributedProofreaders:master Dec 31, 2025
9 checks passed
@cpeel cpeel deleted the cache-some-api-responses branch December 31, 2025 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants