slonik-interceptor-query-cache 3.0.0 → 3.1.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 +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,9 +21,15 @@ Which queries are cached is controlled using cache attributes. Cache attributes
|
|
|
21
21
|
|Cache attribute|Description|Required?|Format|Default|
|
|
22
22
|
|---|---|---|---|---|
|
|
23
23
|
|`@cache-ttl`|Number (in seconds) to cache the query for.|Yes|`/^d+$/`|N/A|
|
|
24
|
-
|`@cache-key`|
|
|
24
|
+
|`@cache-key`|Cache key that uniquelly identifies the query.|No|`/^[$A-Za-z0-9\-_:]+$/`|`$bodyHash:$valueHash`|
|
|
25
25
|
|`@cache-discard-empty`|If set to `true`, then `storage.set` is not invoked when query produces no results.|No|`/^(false|true)$/`|`false`|
|
|
26
26
|
|
|
27
|
+
### `@cache-key`
|
|
28
|
+
|
|
29
|
+
Overrides the default cache key that uniquely identifies the query.
|
|
30
|
+
|
|
31
|
+
If present, `$bodyHash` is substituted with the hash of the query (comments and white-spaces are stripped before hashing the query). `$valueHash` is substituted with the hash of the parameter values.
|
|
32
|
+
|
|
27
33
|
### Example usage
|
|
28
34
|
|
|
29
35
|
This example shows how to create a compatible storage service using [`node-cache`](https://www.npmjs.com/package/node-cache).
|
package/package.json
CHANGED