Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we store MultiDimentional Array In redis

Tags:

redis

Is it possible to store multidimensional array in Redis hash

For example

HMSET('Marray','Name'=>"test12",
               "Age"=>"45",
               "Salary"=>"50000",
               "GENDER"=>array("M"=>"1","F"=>"2"))

Or is any other possibility to store the above values

like image 318
vijay Avatar asked Jan 27 '26 18:01

vijay


1 Answers

You can serialize that sub-array (as JSON, for example) and store it in a hash field. Redis doesn't support arbitrarily nested structures.

Or you can even serialize the whole structure and store it as plain string.

like image 84
Sergio Tulentsev Avatar answered Jan 31 '26 21:01

Sergio Tulentsev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!