From 8e9978167c56e85438201446ca0800ea60e38c3f Mon Sep 17 00:00:00 2001 From: Gajus Kuizinas Date: Tue, 25 Apr 2023 16:20:18 -0600 Subject: [PATCH] feat: add @cache-discard-empty --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c9bfc0..47533a4 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,15 @@ Which queries are cached is controlled using cache attributes. Cache attributes |Cache attribute|Description|Required?|Format|Default| |---|---|---|---|---| |`@cache-ttl`|Number (in seconds) to cache the query for.|Yes|`/^d+$/`|N/A| -|`@cache-key`|Uniquelly identifies the query. Overrides the default cache key that uniquely identifies the query. 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.|No|`/^[$A-Za-z0-9\-_:]+$/`|`$bodyHash:$valueHash`| +|`@cache-key`|Cache key that uniquelly identifies the query.|No|`/^[$A-Za-z0-9\-_:]+$/`|`$bodyHash:$valueHash`| |`@cache-discard-empty`|If set to `true`, then `storage.set` is not invoked when query produces no results.|No|`/^(false|true)$/`|`false`| +### `@cache-key` + +Overrides the default cache key that uniquely identifies the query. + +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. + ### Example usage This example shows how to create a compatible storage service using [`node-cache`](https://www.npmjs.com/package/node-cache).