Skip to content

feat(cache): 添加全局缓存系统#2917

Open
whitecat346 wants to merge 5 commits into
PCL-Community:devfrom
whitecat346:feat/gcache
Open

feat(cache): 添加全局缓存系统#2917
whitecat346 wants to merge 5 commits into
PCL-Community:devfrom
whitecat346:feat/gcache

Conversation

@whitecat346
Copy link
Copy Markdown
Member

@whitecat346 whitecat346 commented May 30, 2026

不是很想写描述,总之建议各位多做测试,各种环境都试试……

由 Sourcery 提供的摘要

引入一个全局的磁盘持久化缓存子系统,并将其集成到 HTTP 网络层中。

新功能:

  • 添加可复用的缓存服务抽象层,使用 SQLite 作为元数据存储、文件系统作为数据存储,支持过期时间、优先级、分组和标签。
  • 引入全局缓存生命周期管理器以及用于在各功能模块中统一构建缓存键的辅助工具。
  • 基于新的缓存服务添加 HTTP 响应缓存功能,包括 ETag/Last-Modified 处理以及缓存命中/未命中响应头。

增强:

  • 使用通用的缓存服务替换之前仅限于 HTTP 的缓存仓库实现。
  • 实现后台淘汰和压缩逻辑,用于控制缓存大小并清理过期条目。

测试:

  • 添加覆盖缓存服务行为、SQLite 存储、文件存储以及端到端缓存流程的全面单元测试和集成测试。
Original summary in English

Summary by Sourcery

Introduce a new global disk-backed cache subsystem and integrate it into HTTP networking.

New Features:

  • Add a reusable cache service abstraction with SQLite metadata and filesystem-backed storage supporting expiration, priorities, groups, and tags.
  • Introduce a global cache lifecycle manager and key helpers for consistent cache key construction across features.
  • Add HTTP response caching based on the new cache service, including ETag/Last-Modified handling and cache hit/miss headers.

Enhancements:

  • Replace the previous HTTP-specific cache repository with the generalized cache service.
  • Implement background eviction and compaction logic to manage cache size and cleanup expired entries.

Tests:

  • Add comprehensive unit and integration tests covering cache service behavior, SQLite storage, file storage, and end-to-end cache workflows.

@whitecat346 whitecat346 self-assigned this May 30, 2026
@pcl-ce-automation pcl-ce-automation Bot added 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 size: XXL PR 大小评估:巨型 labels May 30, 2026
@whitecat346
Copy link
Copy Markdown
Member Author

@sourcery-ai summary

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Sorry @whitecat346, your pull request is larger than the review limit of 150000 diff characters

Copy link
Copy Markdown
Member

@lhx077 lhx077 left a comment

Choose a reason for hiding this comment

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

我这边没找到什么问题,代码质量也很好,这个想法也很有创新点
LGTM

@whitecat346
Copy link
Copy Markdown
Member Author

我这边没找到什么问题,代码质量也很好,这个想法也很有创新点
LGTM

我比较担心的就是实际使用的情况,因为我这里没法做大量的测试,忙于学业嘛。希望有人可以专门去测试一下,多找问题,这个是很底层的组件,需要确保稳定

@lhx077 lhx077 requested a review from a team May 30, 2026 10:02
@MoYuan-CN
Copy link
Copy Markdown
Member

等一手测试吧,如果纯代码审查没看到明显问题的话。
btw 有 PR 冲突了现在

@whitecat346
Copy link
Copy Markdown
Member Author

等一手测试吧,如果纯代码审查没看到明显问题的话。 btw 有 PR 冲突了现在

测试的话单测是没问题的,能通过

Copy link
Copy Markdown
Contributor

@tangge233 tangge233 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@MoYuan-CN MoYuan-CN left a comment

Choose a reason for hiding this comment

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

LGTM. btw conflict :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XXL PR 大小评估:巨型 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants