freyja 将引入“分组”概念进一步提高维护缓存时的效率

目前的freyja在维护缓存的时候是将表分为多个字段,每个字段负责维护与字段有关的缓存。

当字段update的时候去检测是否需要缓存失效。
经过我对这些数据的分析,引入分组概念能加快维护缓存的效率。

例如,大部分数据都是围绕用户产生的,User、Hero、Building 他们都是一对多关系,在这些表当中,大部分查询都是限于当前用户的数据查询。那么按userId分组将大大的减少检索的内容,从而提高维护缓存的效率。

当然其他的表也可以根据自己的情况分组/不分组。

另外也许还会采用single注解减少update操作,被single注解的表明当前字段不会出现在联表查询范围内。那么这个字段的update操作就不需要序列化到数据库,在系统关闭/缓存过期的时候update一次就足够了

 

 

 

[Freyja] [SQL] update t_hero set STATUS = ?,holdNumber = ? where ID = ? [args] 1 100 6769 

[Freyja]

14:14:26,718 - 扫描cache: SELECT * FROM t_hero AS h WHERE h.user_id = ? AND STATUS >= 0#@7272

 

14:14:26,718 - 扫描cache: SELECT * FROM t_hero WHERE user_id = ? AND CITY_ID = 0 AND STATUS IN (0, 1)#@7273

 

 

14:14:26,718 - 移除 cache:from Hero where userId = ? and cityId = 0 and status in (0,1)#null#null#0#@7273

 

14:14:26,718 - 移除 cache:SELECT * FROM t_hero WHERE user_id = ? AND CITY_ID = 0 AND STATUS IN (0, 1)#@7273

 

14:14:26,718 - 扫描cache: SELECT * FROM t_hero WHERE user_id = ? AND CITY_ID = 0 AND STATUS IN (0, 1)#@7272

 

14:14:26,718 - 扫描cache: SELECT * FROM t_hero AS t WHERE t.user_id = 7273 AND STATUS >= 0#

 

 

14:14:26,718 - 移除 cache:select t.id as id,t.name as name,t.level as level,t.legendFlag as legendFlag,t.status as status,t.cityId as cityId,t.holdNumber as holdNumber,t.battleAtTime as battleAtTime from Hero t where t.userId = 7273 and status >=0#null#null#1#

 

14:14:26,718 - 扫描cache: SELECT * FROM t_hero AS t WHERE t.user_id = 7272 AND STATUS >= 0#

 

14:14:26,718 - 扫描cache: SELECT * FROM t_hero AS h WHERE h.user_id = ? AND STATUS >= 0#@7273

 

 

14:14:26,718 - 移除 cache:select  h.id as id,h.name as name,h.status as status from Hero h where h.userId = ? and status >= 0#null#null#1#@7273

 

14:14:26,718 - 扫描cache: SELECT * FROM t_hero WHERE user_id = ? AND CITY_ID = 0 AND STATUS IN (0, 1)#@7272

 

14:14:26,718 - 扫描cache: SELECT * FROM t_hero AS h WHERE h.user_id = ? AND STATUS >= 0#@7272

 

14:14:26,718 - 扫描cache: SELECT * FROM t_hero WHERE user_id = ? AND CITY_ID = 0 AND STATUS IN (0, 1)#@7272

 

 

14:14:26,718 - 扫描cache: SELECT * FROM t_hero AS t WHERE t.user_id = 7273 AND STATUS >= 0#

 

14:14:26,718 - 移除 cache:select t.id as id,t.name as name,t.level as level,t.legendFlag as legendFlag,t.status as status,t.cityId as cityId,t.holdNumber as holdNumber,t.battleAtTime as battleAtTime from Hero t where t.userId = 7273 and status >=0#null#null#1#

 

 

14:14:26,718 - 扫描cache: SELECT * FROM t_hero AS t WHERE t.user_id = 7272 AND STATUS >= 0#

 

 

14:14:26,718 - 扫描cache: SELECT * FROM t_hero AS h WHERE h.user_id = ? AND STATUS >= 0#@7273

 

14:14:26,718 - 移除 cache:select  h.id as id,h.name as name,h.status as status from Hero h where h.userId = ? and status >= 0#null#null#1#@7273

 



一个用户的hero更新,按照现在的需要扫描所有用户的hero,通过分组可以将扫描内容减少到之前的 1/n n为用户数。




7272 和7273 为2个用户的ID

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,以下是一个简单的关于北欧神话的网站的制作步骤: 1. 创建一个新的HTML文件,并在文件头部添加必要的元数据,如标题、字符集和CSS样式表等。 ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>北欧神话</title> <link rel="stylesheet" href="style.css"> </head> <body> <!-- 在此添加页面内容 --> </body> </html> ``` 2. 在网页中添加内容,可包括图片、文本、链接和列表等。 ```html <body> <header> <h1>北欧神话</h1> <nav> <ul> <li><a href="#introduction">简介</a></li> <li><a href="#gods">众神</a></li> <li><a href="#creatures">生物</a></li> <li><a href="#myths">传说</a></li> </ul> </nav> </header> <main> <section id="introduction"> <h2>简介</h2> <p>北欧神话是指北欧地区的古老宗教和传说。它包括了世界的创造、众神的故事、人类的起源和命运等方面的内容。</p> </section> <section id="gods"> <h2>众神</h2> <ul> <li>奥丁(Odin)</li> <li>托尔(Thor)</li> <li>洛基(Loki)</li> <li>弗雷(Freyr)</li> <li>弗蕾娅(Freyja)</li> </ul> </section> <section id="creatures"> <h2>生物</h2> <ul> <li>世界蛇(Jormungandr)</li> <li>狼(Fenrir)</li> <li>巨人(Jotun)</li> <li>精灵(Elf)</li> </ul> </section> <section id="myths"> <h2>传说</h2> <ol> <li>诸神之黄昏</li> <li>雷神之锤</li> <li>洛基的骗局</li> <li>弗雷迦的领婚</li> </ol> </section> </main> <footer> <p>版权所有 © 2021 北欧神话网站</p> </footer> </body> ``` 3. 使用CSS样式表为网页添加样式和布局。 ```css body { font-family: Arial, sans-serif; margin: 0; padding: 0; } header { background-color: #333; color: #fff; padding: 10px; display: flex; justify-content: space-between; align-items: center; } nav ul { list-style: none; display: flex; } nav li { margin-right: 20px; } nav a { text-decoration: none; color: #fff; font-weight: bold; } main { max-width: 800px; margin: 0 auto; padding: 20px; } section { margin-bottom: 40px; } h2 { font-size: 24px; margin-bottom: 10px; } ul, ol { margin-left: 20px; } footer { background-color: #333; color: #fff; padding: 10px; text-align: center; } ``` 4. 保存文件并在浏览器中打开,即可查看效果。 以上是一个简单的关于北欧神话的网站的制作步骤,您可以根据自己的需求进行修改和完善。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值