You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-9Lines changed: 19 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,20 @@
6
6
A plugin for the serverless framework which helps with configuring caching for API Gateway endpoints.
7
7
8
8
## Good to know
9
-
If you enable caching globally, it does NOT automatically enable caching for your endpoints - you have to be explicit about which endpoints should have caching enabled.
9
+
*If you enable caching globally, it does NOT automatically enable caching for your endpoints - you have to be explicit about which endpoints should have caching enabled.
10
10
However, disabling caching globally disables it across endpoints.
11
+
* If you don't specify `ttlInSeconds` and `perKeyInvalidation` for an endpoint which has caching enabled, these settings are inherited from global settings.
12
+
* For HTTP method `ANY`, caching will be enabled only for the `GET` method and disabled for the other methods.
13
+
14
+
## Per-key cache invalidation
15
+
If you don't configure per-key cache invalidation authorization, by default it is *required*.
16
+
You can configure how to handle unauthorized requests to invalidate a cache key using the options:
17
+
*`Ignore` - ignores the request to invalidate the cache key.
18
+
*`IgnoreWithWarning` - ignores the request to invalidate and adds a `warning` header in the response.
19
+
*`Fail` - fails the request to invalidate the cache key with a 403 response status code.
20
+
21
+
## Currently not supported:
22
+
* lambda functions with many HTTP events.
11
23
12
24
## Example
13
25
@@ -21,6 +33,9 @@ custom:
21
33
enabled: true
22
34
clusterSize: '0.5'# defaults to '0.5'
23
35
ttlInSeconds: 300# defaults to the maximum allowed: 3600
36
+
perKeyInvalidation:
37
+
requireAuthorization: true # default is true
38
+
handleUnauthorizedRequests: IgnoreWithWarning # default is "IgnoreWithWarning"
24
39
25
40
functions:
26
41
# Responses are not cached
@@ -44,15 +59,10 @@ functions:
44
59
caching:
45
60
enabled: true
46
61
ttlInSeconds: 3600
62
+
perKeyInvalidation:
63
+
requireAuthorization: true
64
+
handleUnauthorizedRequests: Ignore
47
65
cacheKeyParameters:
48
66
- name: request.path.pawId
49
-
required: true
50
67
- name: request.header.Accept-Language
51
-
required: false
52
68
```
53
-
54
-
## Limitations
55
-
* For HTTP method `ANY`, caching will be enabled only for the `GET` method and disabled for the other methods.
0 commit comments