perf(redis-template): 优化update方法原子性,减少Redis网络往返次数,提升高并发场景性能与数据一致性#915
Open
07heco wants to merge 1 commit into
Open
perf(redis-template): 优化update方法原子性,减少Redis网络往返次数,提升高并发场景性能与数据一致性#91507heco wants to merge 1 commit into
07heco wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
优化概述
本次 PR 针对 sa-token-redis-template 模块的 update 方法进行性能与原子性优化,无任何 API 变更,100% 向后兼容,核心解决原有实现的网络开销与数据一致性问题。
优化背景与现存问题
当前 SaTokenDaoForRedisTemplate 类中的 update 方法,在高并发生产场景下存在两个核心问题:
优化方案
本次优化通过 Redis Lua 脚本实现操作的原子化改造,核心改动如下:
优化收益
兼容性保障