0

I want to store JSON DATA in Redis How I can do that what is the best option to store JSON in Redis. my object will look like

{"name":"b123.home.group.title", "value":"Hellow World", "locale":"en-us", "uid":"b456"}

I want to update the object based on value and locale. also want to get this object with any condition. also want TTL support here (that I can remove if not required)

So what is the best way to store this data in Redis without any Memory issue and support all operations with less time?

Suraj Dalvi
  • 988
  • 1
  • 20
  • 34
  • You would have to store the Json as a string in Redis, then `get` it again, update the keys you want to update and store the full Json again. To manipulate Json directly in Redis, you could use Redis' LUA scripting capabilities but this is probably too complicated for your usecase – Gab Jan 26 '21 at 22:20
  • using string to get an update is complex is there any direct way or using HashSet? – Suraj Dalvi Jan 26 '21 at 22:24
  • You can HashSet to store keys and values of a Json into a Redis item but it's not a Json anymore, it's a HashSet – Gab Jan 26 '21 at 22:31
  • yes, you are right but I have updated my format like HSET. need to test String is not good for me. but I just want to know is any limit in the Redis hash set like field limit, field size limit, data limit, etc please let me know? – Suraj Dalvi Jan 26 '21 at 22:55
  • to the best of my knowledge there is no limit, it is up to the RAM available to Redis – Gab Jan 26 '21 at 23:06
  • Did you check the RedisJSON Module for Redis? (https://redisjson.io) – Guy Korland Jan 27 '21 at 06:43
  • no can I use this in nodejs – Suraj Dalvi Jan 27 '21 at 10:02
  • Sure see https://www.npmjs.com/package/redis-modules-sdk – Guy Korland Feb 13 '21 at 06:25

0 Answers0