Use RedisJSON to store json objects
sebaplaza opened this issue · comments
Hello,
Currently, keyv use json-buffer as default serializer/deserialize. We store everything as a string.
These are high consuming cpu functions, and when the main goal is to be fast, this is not ideal.
Redis has a native way to store json objects, using RedisJSON. This is not enabled by default, but is not so difficult to enable it.
Anyway, the @keyv/redis lib is not using this api, which in understandable, but would be great to support it, optionally.
What can be done to add RedisJSON support to keyv ecosystem ?
Hello,
You can easily customize the default serialize/deserialize, see https://github.com/microlinkhq/keyvhq#serialization.
The value is serialized using the serializer before being stored, see https://github.com/microlinkhq/keyvhq/blob/master/packages/core/src/index.js#L85
Could be interesting if RedisJSON
as serializer is available as standalone package, do you know something about that?
I don't know.
Maybe there is something interesting in this repo : https://github.com/redis/node-redis/tree/master/packages/json