0

Data Field as

  typedef struct Info
  {
     std::string Name;
     std::string Address;
     ...
     So on
  };

and Want to store data in Redis Here. there may a instance when some of the field of structure can repeat. How can i make above struct in Redis and store. There is one condition. if data of same value exist. don't overwrite. add new row.

Like this but it's in Programming Language

 std::list<Info> infoList_;

And able to search also;

2
  • What do you mean by 'some of the field of structure can repeat'? And you want to search it in what way? Commented Jan 23, 2018 at 9:01
  • lets say there is field of state in Info. For multiple people the value can be same. and I want to search people of age of 24. Like this. [searching of data is not important ]. Commented Jan 23, 2018 at 9:16

1 Answer 1

1

Redis don't provide a data structure that can store a list of complex object structure.

But you can maybe use a redis module like :

Both modules can store complex data structure.

Sign up to request clarification or add additional context in comments.

6 Comments

Lets say if I have entry in Redis Like this. these are Keys ABC:22:1, ` ABC:22.2, ABC:22:3. can i somehow access them with ABC:22:*` or "ABC:". Yes then Please
I got it.. SCAN 0 MATCH *ABC:*` COUNT 1000
Next i want to know, how to get number of keys of matching pattern
You can't do this. The only way i see is to assign keys with pattern ABC:22:* for example in database 1 then keys with pattern ABC:23:* in database 2 and so on. Then if you want to know how many keys with pattern ABC:22:* redis contains, you have to execute SELECT 1 then DBSIZE commands
DBSIZE [Return the number of keys in the currently-selected database.]. it won't say how many keys are there with matching pattern.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.