fix(op): invalidate new path cache on meta path update#2322
Merged
jyxjjj merged 1 commit intoOpenListTeam:mainfrom Apr 9, 2026
Merged
fix(op): invalidate new path cache on meta path update#2322jyxjjj merged 1 commit intoOpenListTeam:mainfrom
jyxjjj merged 1 commit intoOpenListTeam:mainfrom
Conversation
UpdateMeta only cleared the old path from cache, leaving a stale nil entry at the new path if it had been accessed before. Now also clears the new path's cache entry so changes take effect immediately. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jyxjjj
approved these changes
Apr 9, 2026
lyy2005a2
pushed a commit
to lyy2005a2/OpenList
that referenced
this pull request
Apr 17, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
问题
修改 meta 的路径后,新路径不会立即生效。
根因:
UpdateMeta更新路径时,只清除了旧路径的缓存(old.Path),但未清除新路径可能已存在的缓存。如果新路径曾被访问过(缓存了
nil,即"不存在"),该负缓存不会被清除,导致访问新路径时仍命中缓存返回
MetaNotFound,最长持续 1 小时(缓存 TTL)。修复
在
UpdateMeta中同时清除新路径的缓存,确保下次访问时从数据库重新加载。变更
internal/op/meta.go:UpdateMeta增加metaCache.Del(u.Path)