Skip to content

fix: 去掉 SettingServiceImpl 进程私有缓存,改用 RowStrategy#151

Merged
lileiseven merged 1 commit into
masterfrom
bugfix/setting-row-cache
Jun 10, 2026
Merged

fix: 去掉 SettingServiceImpl 进程私有缓存,改用 RowStrategy#151
lileiseven merged 1 commit into
masterfrom
bugfix/setting-row-cache

Conversation

@ahajason

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings June 10, 2026 07:19
@lileiseven
lileiseven merged commit 1fccca9 into master Jun 10, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread composer.json
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"
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants