jss
V2EX  ›  PHP

需求:如何实现短期内刷新不重复,数据库 1W 条记录

  •  
  •   jss · Apr 1, 2019 · 4473 views
    This topic created in 2805 days ago, the information mentioned may be changed or developed.

    数据库 1W 条记录,用户短期内刷新均展示未浏览数据,另外,接口分页下发 10 条数据,如何判断这 10 条数据哪些是用户浏览过的,有好的方案吗?

    4 replies  •  2019-04-06 08:45:35 +08:00
    jabin88
    jabin88
    Apr 1, 2019
    1
    放 redis (差集)或 mongodb
    whileFalse
    whileFalse
    Apr 1, 2019 via iPhone
    2
    1. 每次做分页查询,把 nextpageindex 写入 cookie
    2. 看你的业务估计不太关注数据时效性,那么全放内存里随机返回即可
    herojaxy
    herojaxy
    Apr 1, 2019
    3
    最简单的方式,表里加个 read 字段不就行了,担心性能再加上索引
    hero2040407
    hero2040407
    Apr 6, 2019
    4
    对每个用户都不一样,redis,或 mongodb,或再建个表,功能实现还是简单,就是你想怎么做的问题
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   939 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 22:45 · PVG 06:45 · LAX 14:45 · JFK 17:45
    ♥ Do have faith in what you're doing.