Skip to content

Commit

Permalink
docs: 新增QA“多个项目共用同一个 redis,怎么防止冲突?”
Browse files Browse the repository at this point in the history
  • Loading branch information
click33 committed Feb 19, 2025
1 parent 855e13f commit bc52623
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sa-token-doc/more/common-questions.md
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,15 @@ SaHolder.getResponse().setStatus(401)



### Q:多个项目共用同一个 redis,怎么防止冲突?

首先,如无特殊需求,建议多个项目不要共用同一个 redis,如果非要共用,有以下方式避免数据冲突:

- 方式 1:使用不同的 db 索引,Redis 默认提供 16 个 database 容器,每个项目配置不同的 db 索引即可。
- 方式 2:给项目配置不同的 `sa-token.token-name` 值,此配置项默认为 `satoken`,是框架在 Redis 存储数据时使用的统一前缀。
- 方式 3:使用 `sa-token-three-redis-jackson-add-prefix` 插件,参考:[sa-token-three-plugin](https://gitee.com/sa-tokens/sa-token-three-plugin)


### Q:还是有不明白到的地方?
请在`gitee``github` 提交 `issues`,或者加入qq群交流,[群链接](/more/join-group)

0 comments on commit bc52623

Please sign in to comment.