-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #347 from subsquid/misc-fixes-by-abernatskiy-dec18
Misc fixes by abernatskiy dec18
- Loading branch information
Showing
14 changed files
with
145 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,20 +6,30 @@ description: Enable caching for faster queries | |
|
||
# Caching | ||
|
||
**Available since `@subsquid/[email protected]`** | ||
|
||
The GraphQL API server provided by `@subsquid/graphql-server` supports caching via additional flags. It is done on a per-query basis. The whole response is cached for a specified amount of time (`maxAge`). | ||
|
||
To enable caching when deploying to Subsquid Cloud, add the caching flags to `cmd` sections of the [deployment manifest](/cloud/reference/manifest/#deploy). Cloud currently supports only in-memory cache, with Redis-based cache to be supported in the near future. | ||
For example, the snippet below will deploy a GraphQL API server with a `100Mb` in-memory cache and invalidation time of `5` seconds: | ||
|
||
To enable caching when deploying to Subsquid Cloud, add the caching flags to the `serve:prod` command definition at `commands.json`, then use that command to run the server in the [deployment manifest](/cloud/reference/manifest/#deploy). Cloud currently supports only in-memory cache. | ||
For example, snippets below will deploy a GraphQL API server with a `100Mb` in-memory cache and invalidation time of `5` seconds: | ||
|
||
```json title="commands.json" | ||
... | ||
"serve:prod": { | ||
"description": "Start the GraphQL API server with caching and limits", | ||
"cmd": [ "squid-graphql-server", | ||
"--dumb-cache", "in-memory", | ||
"--dumb-cache-ttl", "5000", | ||
"--dumb-cache-size", "100", | ||
"--dumb-cache-max-age", "5000" ] | ||
} | ||
... | ||
``` | ||
|
||
```yaml title="squid.yaml" | ||
# ... | ||
deploy: | ||
# other services ... | ||
api: | ||
cmd: [ "npx", "squid-graphql-server", "--dumb-cache", "in-memory", "--dumb-cache-ttl", "5000", "--dumb-cache-size", "100", "--dumb-cache-max-age", "5000" ] | ||
cmd: [ "sqd", "serve:prod" ] | ||
``` | ||
Caching flags list is available via `npx squid-graphql-server --help`. Here are some more details on them: | ||
|
Oops, something went wrong.