search

Home  >  Q&A  >  body text

新手问个班级存储的redis数据格式设计问题

新手问个班级存储的redis数据格式设计问题
数据有

school
school_id, school_name

class
school_id, class_id, class_name ...

user
user_id, user_name, class_id ....

需求
根据 school_id 能快速筛选所有班级
根据 class_id 能快速筛选所有user

目前数据量,user 有200w+, class 10w+

没用过redis, 求问怎么设计这个结够.

阿神阿神2798 days ago631

reply all(1)I'll reply

  • 迷茫

    迷茫2017-04-22 08:58:17

    The easiest way: set
    school:1 (classid1, classid2, ..., classidN)
    class:1 (userid1, userid2, ..., useridN)


    More detailed business scenarios may be needed

    reply
    0
  • Cancelreply