Skip to content

v0.4.1

Choose a tag to compare

@pardnchiu pardnchiu released this 09 Apr 18:39
· 13 commits to master since this release

v0.4.0 -> v0.4.1

Summary

Extract shared core struct to enable Session support, add lazy DB replay and parallel compaction for faster startup/shutdown, replace channel-based cancellation with context.Context, support custom storage path via New(path), and sync Expire/Persist changes to JSON cache files.

翻譯 抽離共用 core 結構體支援 Session、新增延遲載入與並行 compact 加速啟動與關閉、以 context.Context 取代 channel 取消機制、支援自訂儲存路徑、修正 Expire/Persist 未同步寫入 JSON 快取檔案。

Changes

FEAT

  • Add Session type sharing core db routing, allowing independent db index per session
  • Add custom storage path support via New(path ...string) with directory validation
翻譯
  • 新增 Session 類型共用 core db 路由,每個 session 可獨立切換 db index
  • 透過 New(path ...string) 支援自訂儲存路徑,含目錄驗證

FIX

  • Sync Expire/ExpireAt/Persist changes to JSON cache files, matching Set/Del behavior
  • Remove expired key's JSON cache file in cleanExpired, consistent with Del
翻譯
  • 修正 Expire/ExpireAt/Persist 變更未同步寫入 JSON 快取檔案,與 Set/Del 行為一致
  • 清除過期 key 時同步刪除對應 JSON 快取檔案,與 Del 行為一致

REFACTOR

  • Extract core struct with DB(), Current(), Select() methods shared by Store and Session
  • Move all command methods from *Store receiver to *core receiver
翻譯
  • 抽離 core 結構體,DB()Current()Select()StoreSession 共用
  • 所有命令方法從 *Store receiver 遷移至 *core receiver

PERF

  • Add lazy DB replay via sync.Once, only loading AOF on first access instead of all 16 at startup
  • Parallelize compact() in Close() using goroutines, reducing shutdown time to slowest single DB
  • Replace unbuffered cleanCh channel with context.Context cancellation, eliminating potential deadlock on shutdown
翻譯
  • 透過 sync.Once 延遲載入 DB,首次存取才 replay AOF,啟動不再掃描全部 16 個 DB
  • Close() 中以 goroutine 並行執行 compact(),關閉耗時降為最慢單一 DB
  • context.Context 取消機制取代無緩衝 channel,消除關閉時潛在 deadlock

Files Changed

File Status Tag
core/store/store.go Modified FEAT
core/store/ttl.go Modified FIX
core/store/exec.go Modified REFACTOR
core/store/get.go Modified REFACTOR
core/store/set.go Modified REFACTOR
core/store/del.go Modified REFACTOR
core/store/find.go Modified REFACTOR
core/store/query.go Modified REFACTOR
core/store/keys.go Modified REFACTOR
core/store/incr.go Modified REFACTOR
core/store/incrField.go Modified REFACTOR
core/store/setField.go Modified REFACTOR
cmd/test/main.go Modified UPDATE

Generated by SKILL