fix: 去掉 SettingServiceImpl 进程私有缓存,改用 RowStrategy#151
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
该 PR 移除了 SettingServiceImpl 内部基于 array_storage 的进程私有缓存,改为通过 DAO 的 RowStrategy(行级缓存)来缓存 getByName 读取结果,以便在更新/删除时由行缓存策略统一做失效处理,并补充了相应的集成测试覆盖。
Changes:
SettingServiceImpl:删除进程内 settings 全量缓存与clearCache()调用,读取改为直接走SettingDao::getByName()。SettingDaoImpl:启用 Row 缓存策略(@CacheStrategy("Row")+@RowCache)并将 declares 的cache改为row。SettingServiceTest:新增用例覆盖 set 后读取新值、RowStrategy 缓存命中与更新/删除后的缓存失效行为。composer.json:调整依赖版本与 require-dev 依赖列表。
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/Setting/SettingServiceTest.php | 新增用例验证设置读取一致性、RowStrategy 缓存命中与失效行为 |
| src/Setting/Service/Impl/SettingServiceImpl.php | 移除进程内缓存,读取改为直接 DAO 查询以交由 RowStrategy 处理缓存 |
| src/Setting/Dao/Impl/SettingDaoImpl.php | 启用 RowStrategy + @RowCache,并将 DAO declares 缓存策略切换为 row |
| composer.json | 调整依赖版本与 require-dev 列表(当前会导致测试依赖缺失) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
36
to
40
| "require-dev": { | ||
| "mockery/mockery": "^0.9.9", | ||
| "phpunit/phpunit": "^9.1 || ^10.1", | ||
| "ramsey/uuid": "^3.9", | ||
| "phpspec/prophecy": "^1.18", | ||
| "phpspec/prophecy-phpunit": "^2.1" | ||
| "mockery/mockery": "^1.3", | ||
| "phpunit/phpunit": "^8.5", | ||
| "ramsey/uuid": "^3.9" | ||
| }, |
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.
No description provided.