Closed codeflyer closed 2 years ago
This is not needed. It's already possible to use whatever algorithm we want for this by using the serialize
option.
Changing https://github.com/mercurius-js/cache/blob/ba55f7b4a56bbdcd2f1081bac8e9acae20a3dd4b/index.js#L111
to return JSON.stringify({ self, arg, fields, extendKey })
As mentioned here: https://github.com/mcollina/async-cache-dedupe/issues/8
the
safe-stable-stringify
is a bottleneck in the key generation.The
safe-stable
option is not always required. When the source of the keys is well know the developer can choose to use theJSON.stringify
function instead of having a safe one.A GQL server, for examples, does the request always in the same way and a lot of cache parameters are often very simple
eg.
Using the
non-safe
version can cause more values in the cache but some times the result is better than having an over optimised cache.