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 ...
- 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' }] }
- 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.