C++ Redis:我可以存储一个c/c++;包含指向Redis中数组指针的结构类型?

C++ Redis:我可以存储一个c/c++;包含指向Redis中数组指针的结构类型?,c++,c,database,redis,key-value,C++,C,Database,Redis,Key Value,我有一个这样的结构: struct father { int child_n; //the number of children int *child_age; //childrens' age } 我可以将这种具有可变长度数组的结构存储在Redis中吗?我用嵌套的*Redis列表解决了它,下面是一个示例: #包括 #包括 #包括 #包括 类型定义结构stu{ int stu_num; int*stu_年龄; }斯图; 使用名称空间std; 无效放置(字符串键,stu学生){

我有一个这样的结构:

struct father {
    int child_n; //the number of children
    int *child_age; //childrens' age
}

我可以将这种具有可变长度数组的结构存储在Redis中吗?

我用嵌套的*Redis列表解决了它,下面是一个示例:

#包括
#包括
#包括
#包括
类型定义结构stu{
int stu_num;
int*stu_年龄;
}斯图;
使用名称空间std;
无效放置(字符串键,stu学生){
//连接到Redis服务器
redisContext*connect=redisConnect(“127.0.0.1”,6379);
如果(!连接){
cout stu_age=(int*)malloc(r_students->stu num*sizeof(int));
如果(!r_学生->学生年龄){
cout元素[i]>str,r->element[i]>len);
}
}
freeReplyObject(r);
自由(连接);
}
int main(){
斯图斯图a,斯图b;
stu_a.stu_num=3;
int ages[3]={1,2,3};
stu_a.stu_age=年龄;
把“测试1”,测试a;
获取测试(“测试1”和“测试b”);

我想将可变长度数组嵌套为Redis列表可能会有所帮助。我想我解决了它。如果有人有同样的问题,请随时问我。