This repository was archived by the owner on Mar 23, 2026. It is now read-only.
Enhance store/kv module with caching, TTL support, and batch operations#1288
Open
schwefelMe wants to merge 1 commit intotigrisdata-archive:mainfrom
Open
Enhance store/kv module with caching, TTL support, and batch operations#1288schwefelMe wants to merge 1 commit intotigrisdata-archive:mainfrom
schwefelMe wants to merge 1 commit intotigrisdata-archive:mainfrom
Conversation
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
本 PR 为 store/kv 模块引入以下改进:
缓存机制:
新增基于 LRU 的缓存,提升读操作性能并减少后端存储访问。
将缓存集成到 Get 和 Set 操作中。
TTL(生存时间)支持:
新增 TTL 支持的缓存(TTLCache),可自动清理过期的键值对。
在 Get 和 SetWithTTL 操作中加入 TTL 支持。
批量操作:
实现 BatchGet 方法,支持高效的多键值批量读取操作。
详细改动:
新增文件:
store/kv/cache.go:实现 LRU 缓存。
store/kv/ttl.go:实现支持 TTL 的缓存。
修改文件:
store/kv/kv_store.go:将缓存、TTL 和批量操作集成到现有的键值存储逻辑中。
改进优势:
说明
通过缓存机制提升性能。
通过 TTL 自动清理功能优化存储管理。
支持批量操作,提高多键值读取的吞吐量。
测试情况:
为缓存和 TTL 逻辑新增单元测试。
验证批量操作功能的正确性。