Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

主题语言资源在更新主题后存在缓存 #7056

Open
4 tasks done
ruibaby opened this issue Nov 20, 2024 · 1 comment · May be fixed by #7057
Open
4 tasks done

主题语言资源在更新主题后存在缓存 #7056

ruibaby opened this issue Nov 20, 2024 · 1 comment · May be fixed by #7057
Assignees
Labels
area/core Issues or PRs related to the Halo Core kind/bug Categorizes issue or PR as related to a bug.

Comments

@ruibaby
Copy link
Member

ruibaby commented Nov 20, 2024

前置条件

  • 已经在 issues 列表中搜索了相关问题。
  • 这是 Halo 项目本身存在的问题,如果是非项目本身的问题(如:安装部署问题),建议在 Discussions 提交。
  • 已经尝试过停用所有的插件,排除是插件导致的问题。
  • 如果是插件和主题的问题,请在对应的插件和主题仓库提交。

系统信息

使用的哪种方式运行?

Docker Compose

发生了什么?

主题语言资源在更新主题后缓存不会自动刷新,显示的文字为旧版本语言包。

复现步骤

  1. 安装 https://github.com/halo-dev/theme-earth/releases/tag/v1.12.0,这个版本的语言包包含一处错误(下一页按钮的文字)
  2. 更新 https://github.com/halo-dev/theme-earth/releases/tag/v1.12.1,文字依然显示错误
  3. 点击主题 清除模板缓存 之后,恢复正常。

Image

相关日志输出

附加信息

No response

@JohnNiang
Copy link
Member

JohnNiang commented Nov 20, 2024

默认情况下,Thymeleaf 缓存功能是开启的,所以会在解析语言的时候缓存结果。

经过排查,StandardMessageResolver 并没有暴露任何清理缓存的方法,而清理模板缓存知识简单清理 TemplateData 缓存,并不会清理掉 StandardMessageResolver 内的缓存。

综上,我建议清理缓存的时候,直接销毁掉整个 TemplateEngine 是目前最简单粗暴的做法。

/kind bug
/area core

https://github.com/thymeleaf/thymeleaf/blob/db314973254ca8d9ee8661cf13c680b93349ee59/lib/thymeleaf/src/main/java/org/thymeleaf/messageresolver/StandardMessageResolver.java#L261

@f2c-ci-robot f2c-ci-robot bot added kind/bug Categorizes issue or PR as related to a bug. area/core Issues or PRs related to the Halo Core labels Nov 20, 2024
@JohnNiang JohnNiang linked a pull request Nov 20, 2024 that will close this issue
@JohnNiang JohnNiang self-assigned this Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Issues or PRs related to the Halo Core kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants