1

I have thousands of poducts in my catalouge and i decide to use redis as cache solution and search engine , my question is what is better:

every product have about 30 properties like name , price and nested objects like category , attributes ...

  1. to store every product as key like :
JSON.SET product:1 '$' {name:'p1' , price:89  , category: { name:'c1' , 'img':'url'} , attributes:[{name:'attr1', value: 'val1' }] }

JSON.SET product:2 '$' {name:'p2' , price:199  , category: { name:'c1' , 'img':'url'} , attributes:[{name:'attr1', value: 'val1' }] }
  1. OR to store the products in an array of products
JSON.SET products . []
JSON.ARRAPPEND products . {name:'p1' , price:89  , category: { name:'c1' , 'img':'url'} , attributes:[{name:'attr1', value: 'val1' }] }

JSON.ARRAPPEND products . {name:'p2' , price:199  , category: { name:'c1' , 'img':'url'} , attributes:[{name:'attr1', value: 'val1' }] }

I want to use RedisSearch to search and filter the products.

the same question for users , orders and so on.

thanks.

Akelmj
  • 99
  • 4
  • Use RediJson https://redis.io/docs/stack/search/indexing_json/ – Shohanur Aug 29 '22 at 11:30
  • The first option require using redisSearch FT.CREATE index to find data , the second option can find data without resdisSearch using JSON.GET. is this true? – Akelmj Aug 30 '22 at 08:14

0 Answers0