Skip to content

Commit

Permalink
Increase max age for entity list endpoints (#9223)
Browse files Browse the repository at this point in the history
Description:
- Increases max age for entity list endpoints in order to improve performance for these endpoints.
- Adds a note for extended caching to the openapi.yaml

---------

Signed-off-by: mgoelswirlds <[email protected]>
  • Loading branch information
mgoelswirlds authored Sep 3, 2024
1 parent 8982570 commit 45a1e84
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('Response middleware', () => {
await responseHandler(mockRequest, mockResponse, null);
expect(mockResponse.send).toBeCalledWith(JSONStringify(responseData));
expect(mockResponse.set).toHaveBeenNthCalledWith(1, headers.default);
expect(mockResponse.set).toHaveBeenNthCalledWith(2, undefined);
expect(mockResponse.set).toHaveBeenNthCalledWith(2, headers.path[mockRequest.route.path]);
expect(mockResponse.set).toHaveBeenNthCalledWith(3, 'Content-Type', 'application/json; charset=utf-8');
expect(mockResponse.status).toBeCalledWith(mockResponse.locals.statusCode);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cache-control": "public, max-age=10"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cache-control": "public, max-age=10"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cache-control": "public, max-age=10"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cache-control": "public, max-age=1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cache-control": "public, max-age=10"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cache-control": "public, max-age=1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cache-control": "public, max-age=10"
}
8 changes: 4 additions & 4 deletions hedera-mirror-rest/api/v1/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1318,17 +1318,17 @@ paths:
- tokens
tags:
- name: accounts
description: The accounts object represents the information associated with an account entity and returns a list of account information.
description: The accounts object represents the information associated with an account entity and returns a list of account information.The accounts list endpoint is cached and not updated as frequently as the account lookup by a specific ID endpoint.
externalDocs:
url: https://docs.hedera.com/guides/docs/mirror-node-api/cryptocurrency-api#accounts
- name: balances
description: The balance object represents the balance of accounts on the Hedera network.
externalDocs:
url: https://docs.hedera.com/guides/docs/mirror-node-api/cryptocurrency-api#balances
- name: contracts
description: The contracts objects represents the information associated with contract entities.
description: The contracts objects represents the information associated with contract entities.The contracts list endpoint is cached and not updated as frequently as the contract lookup by a specific ID endpoint.
- name: schedules
description: The schedules object represents the information associated with a schedule entity.
description: The schedules object represents the information associated with a schedule entity.The schedules list endpoints is cached and not updated as frequently as the schedule lookup by a specific ID endpoint.
- name: transactions
description: The transaction object represents the transactions processed on the Hedera network.
externalDocs:
Expand All @@ -1338,7 +1338,7 @@ tags:
externalDocs:
url: https://docs.hedera.com/guides/docs/mirror-node-api/cryptocurrency-api#topic-messages
- name: tokens
description: The tokens object represents the information associated with a token entity and returns a list of token information.
description: The tokens object represents the information associated with a token entity and returns a list of token information.The tokens list endpoint is cached and not updated as frequently as the token lookup by a specific ID.
info:
title: Hedera Mirror Node REST API
version: 0.113.0-SNAPSHOT
Expand Down
7 changes: 7 additions & 0 deletions hedera-mirror-rest/config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,19 @@ hedera:
headers:
default: { "cache-control": "public, max-age=1" }
path:
/api/v1/accounts: { "cache-control": "public, max-age=10" }
/api/v1/accounts/:idOrAliasOrEvmAddress:
{ "cache-control": "public, max-age=2" }
/api/v1/accounts/:idOrAliasOrEvmAddress/rewards:
{ "cache-control": "public, max-age=60" }
/api/v1/blocks/:hashOrNumber:
{ "cache-control": "public, max-age=600" }
/api/v1/contracts: { "cache-control": "public, max-age=10" }
/api/v1/contracts/:contractId/results/:consensusTimestamp([0-9.]+):
{ "cache-control": "public, max-age=600" }
/api/v1/contracts/results: { "cache-control": "public, max-age=10" }
/api/v1/contracts/results/logs:
{ "cache-control": "public, max-age=10" }
/api/v1/contracts/results/:transactionIdOrHash:
{ "cache-control": "public, max-age=600" }
/api/v1/contracts/results/:transactionIdOrHash/actions:
Expand All @@ -106,6 +111,8 @@ hedera:
/api/v1/network/nodes: { "cache-control": "public, max-age=60" }
/api/v1/network/stake: { "cache-control": "public, max-age=60" }
/api/v1/network/supply: { "cache-control": "public, max-age=60" }
/api/v1/schedules: { "cache-control": "public, max-age=10" }
/api/v1/tokens: { "cache-control": "public, max-age=10" }
/api/v1/tokens/:tokenId: { "cache-control": "public, max-age=5" }
/api/v1/topics/:topicId/messages/:sequenceNumber:
{ "cache-control": "public, max-age=600" }
Expand Down

0 comments on commit 45a1e84

Please sign in to comment.