API Gateway Caching
Installation
Install @interlace/serverless-api-gateway-caching and verify it loads.
Install
npm install --save-dev @interlace/serverless-api-gateway-cachingpnpm add -D @interlace/serverless-api-gateway-cachingyarn add -D @interlace/serverless-api-gateway-cachingbun add -d @interlace/serverless-api-gateway-cachingWire into the project
plugins:
- '@interlace/serverless-api-gateway-caching'
custom:
interlaceCaching:
enabled: true
clusterSize: '0.5'
ttlInSeconds: 300const serverlessConfiguration = {
plugins: ['@interlace/serverless-api-gateway-caching'],
custom: {
interlaceCaching: {
enabled: true,
clusterSize: '0.5',
ttlInSeconds: 300,
},
},
};module.exports = {
plugins: ['@interlace/serverless-api-gateway-caching'],
custom: {
interlaceCaching: {
enabled: true,
clusterSize: '0.5',
ttlInSeconds: 300,
},
},
};{
"plugins": ["@interlace/serverless-api-gateway-caching"],
"custom": {
"interlaceCaching": {
"enabled": true,
"clusterSize": "0.5",
"ttlInSeconds": 300
}
}
}Smoke test
The dry-run command verifies the plugin registered and your config parses, without touching AWS:
sls caching previewExpected output: a Caching plan block listing each http-event endpoint and the patch operations a deploy would apply.
Next
- Configuration — every option you can set under
custom.interlaceCaching - Migration — switching from the community
serverless-api-gateway-caching - Recipes / cache keys — the most common gotcha