slonik-interceptor-query-cache 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,11 +18,33 @@ Which queries are cached is controlled using cache attributes. Cache attributes
|
|
|
18
18
|
|
|
19
19
|
## Cache attributes
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
#### `@cache-ttl`
|
|
22
|
+
|
|
23
|
+
|Required|Format|Default|
|
|
24
|
+
|---|---|---|
|
|
25
|
+
|Yes|`/^d+$/`|N/A|
|
|
26
|
+
|
|
27
|
+
Number (in seconds) to cache the query for.
|
|
28
|
+
|
|
29
|
+
#### `@cache-key`
|
|
30
|
+
|
|
31
|
+
|Required|Format|Default|
|
|
32
|
+
|---|---|---|
|
|
33
|
+
|No|`/^[$A-Za-z0-9\-_:]+$/`|`$bodyHash:$valueHash`|
|
|
34
|
+
|
|
35
|
+
Cache key that uniquely identifies the query.
|
|
36
|
+
|
|
37
|
+
If present, `$bodyHash` is substituted with the hash of the query (comments and white-spaces are stripped before hashing the query).
|
|
38
|
+
|
|
39
|
+
If present, `$valueHash` is substituted with the hash of the parameter values.
|
|
40
|
+
|
|
41
|
+
#### `@cache-discard-empty`
|
|
42
|
+
|
|
43
|
+
|Required|Format|Default|
|
|
44
|
+
|---|---|---|
|
|
45
|
+
|No|`/^(false|true)$/`|`false`|
|
|
46
|
+
|
|
47
|
+
If set to `true`, then `storage.set` is not invoked when query produces no results.
|
|
26
48
|
|
|
27
49
|
### Example usage
|
|
28
50
|
|
package/package.json
CHANGED