mka
mka

Reputation: 67

Is it bad practice to store JSON as a string in Redis?

I am new to Redis. I am working on a nodejs project. I want to store JSON in Redis for caching.

Should I store JSON as a string or should I use RedisJSON module? What's the difference between them? Like performance and so on.

Upvotes: 5

Views: 3171

Answers (1)

Murat Colyaran
Murat Colyaran

Reputation: 2189

As stated in Redis's documentation, deserializing and serializing JSON creates both extra processing power and extra data size.

That's why it is recommended to use RedisJSON, which is supported by Redis itself.

Most importantly, this both eliminates the risk of data loss and allows you to consume less processing power.

The serialization takes client computational resources during read and write. The JSON format adds size to the data Redis has only indirect ways to manipulate the actual JSON data.

JSON Storage

Upvotes: 8

Related Questions