{"library":"serverless-api-gateway-caching","title":"Serverless API Gateway Caching Plugin","description":"The `serverless-api-gateway-caching` plugin for the Serverless Framework simplifies the configuration of caching for AWS API Gateway REST API endpoints. Its current stable version is 1.11.0. This plugin allows developers to define caching settings both globally for an API Gateway stage and granularly for individual endpoints, including time-to-live (TTL), data encryption, and cache key parameters. It provides fine-grained control over which request elements (path, header, query string) contribute to the cache key. A crucial differentiator is its explicit support for *only* REST API Gateway, as AWS HTTP API does not support native caching at this time. Releases are regular, often driven by bug fixes and minor feature enhancements, making it an actively maintained tool for optimizing API performance and reducing backend load for Serverless applications.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install serverless-api-gateway-caching"],"cli":null},"imports":[],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"plugins:\n  - serverless-api-gateway-caching\n\ncustom:\n  apiGatewayCaching:\n    # Global settings for API Gateway caching\n    enabled: true\n    clusterSize: '0.5' # defaults to '0.5', determines cache capacity\n    ttlInSeconds: 300 # defaults to 3600, max allowed\n    dataEncrypted: true # defaults to false\n    perKeyInvalidation:\n      requireAuthorization: true # default is true\n      handleUnauthorizedRequests: Ignore # default is \"IgnoreWithWarning\"\n    endpointsInheritCloudWatchSettingsFromStage: true # default is true\n\nfunctions:\n  # Example: An endpoint with caching enabled\n  list-all-cats:\n    handler: rest_api/cats/get/handler.handle\n    events:\n      - http:\n          path: /cats\n          method: get\n          caching:\n            enabled: true # Explicitly enable caching for this endpoint\n            ttlInSeconds: 600 # Override global TTL for this endpoint\n\n  # Example: An endpoint with caching enabled and custom cache key parameters\n  get-cat-by-paw-id:\n    handler: rest_api/cat/get/handler.handle\n    events:\n      - http:\n          path: /cats/{pawId}\n          method: get\n          caching:\n            enabled: true\n            # Cache responses based on path parameter 'pawId' and 'Accept-Language' header\n            cacheKeyParameters:\n              - name: request.path.pawId\n              - name: request.header.Accept-Language","lang":"yaml","description":"This `serverless.yml` configuration demonstrates how to enable the `serverless-api-gateway-caching` plugin, define global caching settings for an API Gateway stage, and then apply and override those settings for specific REST API endpoints, including configuring custom cache key parameters.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}