{"id":13584001,"url":"https://github.com/wshirey/kong-plugin-response-cache","last_synced_at":"2026-01-17T12:06:29.018Z","repository":{"id":49778163,"uuid":"79761657","full_name":"wshirey/kong-plugin-response-cache","owner":"wshirey","description":"A Kong plugin that will cache responses in redis","archived":false,"fork":false,"pushed_at":"2019-04-17T14:36:29.000Z","size":9,"stargazers_count":70,"open_issues_count":2,"forks_count":13,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-02T15:54:29.661Z","etag":null,"topics":["cache","kong","kong-plugin","plugin","redis"],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wshirey.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-23T02:12:25.000Z","updated_at":"2023-12-11T06:17:36.000Z","dependencies_parsed_at":"2022-08-29T14:30:12.975Z","dependency_job_id":null,"html_url":"https://github.com/wshirey/kong-plugin-response-cache","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wshirey%2Fkong-plugin-response-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wshirey%2Fkong-plugin-response-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wshirey%2Fkong-plugin-response-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wshirey%2Fkong-plugin-response-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wshirey","download_url":"https://codeload.github.com/wshirey/kong-plugin-response-cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223265124,"owners_count":17116296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","kong","kong-plugin","plugin","redis"],"created_at":"2024-08-01T15:03:57.060Z","updated_at":"2026-01-17T12:06:28.980Z","avatar_url":"https://github.com/wshirey.png","language":"Lua","funding_links":[],"categories":["Lua"],"sub_categories":[],"readme":"# kong-plugin-response-cache\n\nA Kong plugin that will cache JSON responses in redis\n\n## How it works\nWhen enabled, this plugin will cache JSON response bodies and headers that match the \nspecified URI list into redis. The duration for the cached response is set in \nredis and Kong will continue to use the cached response until redis removes it.\n\nThe plugin will only cache JSON responses for GET request methods.\n\n## Cache Key computation\n\nThe cache key will be a concatentation of the following items, in order, each delimited \nwith the `:` character\n\n1. The URI path\n1. Query parameter and value (if defined in `config.vary_by_query_parameters`)\n1. Header name and value (if defined in `config.vary_by_headers`)\n\nQuery strings and headers with multiple values will have those values concatenated\nand command delimited. See the table below for some examples of requests and\ntheir corresponding cache key.\n\nQuery strings and headers are concatenated in the cache key in alphabetical order.\n\nrequest|cache key\n---|---\n`curl /v1/users/wshirey?is_active`|`/v1/users/wshirey:is_active=true`\n`curl /v1/users/wshirey?foo=bar\u0026is_active`|`/v1/users/wshirey:foo=bar:is_active=true`\n`curl /v1/users/wshirey?foo=bar\u0026foo=baz`|`/v1/users/wshirey:foo=bar,baz`\n`curl -H \"X-Custom-ID: 123\" /v1/users/wshirey?is_active=true`|`/v1/users/wshirey:is_active=true:x-custom-id=123`\n`curl -H \"X-Custom-ID: 123\" -H \"X-User-ID: 456\" /v1/users/wshirey?is_active=true`|`/v1/users/wshirey:is_active=true:x-custom-id=123:x-user-id=456`\n`curl -H \"X-Custom-ID: 123\" -H \"X-Custom-ID: 456\" /v1/users/wshirey?is_active=true`|`/v1/users/wshirey:is_active=true:x-custom-id=123,456`\n\n## Configuration\n\nSimilar to the built-in JWT Kong plugin, you can associate the jwt-claims-headers\nplugin with an api with the following request\n\n```bash\ncurl -X POST http://kong:8001/apis/{api_name_or_id}/plugins \\\n  --data \"name=response-cache\" \\\n  --data \"config.cache_policy.uris=/echo,/headers\" \\\n  --data \"config.cache_policy.vary_by_query_parameters=\" \\\n  --data \"config.cache_policy.vary_by_headers=X-Custom-ID\" \\\n  --data \"config.cache_policy.duration_in_seconds=3600\" \\\n  --data \"config.redis_host=127.0.0.1\" \\\n```\n\nform parameter|required|description\n---|---|---\n`name`|*required*|The name of the plugin to use, in this case: `response-cache`\n`cache_policy.uris`|*required*|A comma delimited list of URIs that Kong will cache responses. Supports regular expressions.\n`cache_policy.vary_by_query_parameters`|*optional*|A comma delimited list of query parameters to use to compute cache key.\n`cache_policy.vary_by_headers`|*optional*|A comma delimited list of headers to use to compute cache key.\n`cache_policy.duration_in_seconds`|*required*|The amount of time in seconds that a response will be cached in redis (using the redis [EXPIRE](https://redis.io/commands/expire) command). Redis will be responsible from removing cached responses.\n`redis_host`|*required*|The hostname or IP address of the redis server.\n`redis_timeout`|*required*|The timeout in milliseconds for the redis connection. Defaults to 2000 milliseconds.\n`redis_port`|*optional*|The port of the redis server. Defaults to 6379.\n`redis_password`|*optional*|The password (if required) to authenticate to the redis server.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwshirey%2Fkong-plugin-response-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwshirey%2Fkong-plugin-response-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwshirey%2Fkong-plugin-response-cache/lists"}