Redis学习之路架构之路

redis搜索联想缓存方案设计

2018-12-11  本文已影响0人  阿祥小王子

欢迎关注作者简书
csdn传送门

页面原型
image.png
缓存词库
image.png image.png

说明:

  1. 建议所有的请求都走异步调用
  2. 常用搜索词库数据统计规则:
    每天晚上12点定时取出所有人词库中排名靠前10位的搜索项并放入常用搜索库中
  3. 分数值=原有分数值*1.01+1.01
    分数值初始值为0
    分数值为浮点类型,两位小数
数据库
drop table if exists sc_search_common;

/*==============================================================*/
/* Table: sc_search_common                                      */
/*==============================================================*/
create table sc_search_common
(
   thesauruscommonid    int(64) not null auto_increment comment '主键id',
   key                  char(100) comment '键',
   score                float(10,2) comment '分数',
   updaterid            int(64),
   createrid            int(64),
   createtime           datetime,
   updatetime           datetime,
   state                int(3) comment '0-正常,1-禁用',
   creater              char(16),
   updater              char(16),
   primary key (thesauruscommonid)
);

alter table sc_search_common comment '常用词库存储表';

drop table if exists sc_search_history_user;

/*==============================================================*/
/* Table: sc_search_history_user                                */
/*==============================================================*/
create table sc_search_history_user
(
   searchhistoryuserid  int(64) not null auto_increment comment '主键id',
   userid               int(64) comment '用户id',
   key                  char(100) comment '键',
   score                float(10,2) comment '分数',
   updaterid            int(64),
   createrid            int(64),
   createtime           datetime,
   updatetime           datetime,
   state                int(3) comment '0-正常,1-禁用',
   creater              char(16),
   updater              char(16),
   primary key (searchhistoryuserid)
);

alter table sc_search_history_user comment '个人常用搜索词库';
主从冗余方案

欢迎加入Java猿社区

欢迎加入Java猿社区
上一篇下一篇

猜你喜欢

热点阅读