map[string]*FrontmatterResult GetBuiltinFrontmatterCache returns the cached FrontmatterResult for a builtin virtual file. Returns (result, true) if cached, (nil, false) if not yet cached. IMPORTANT: The returned *FrontmatterResult is a shared, read-only reference. Callers MUST NOT mutate the result
(path string)
| 67 | // Callers MUST NOT mutate the result or any of its fields (Frontmatter map, slices, etc.). |
| 68 | // Use ExtractFrontmatterFromContent directly when you need a mutable copy. |
| 69 | func GetBuiltinFrontmatterCache(path string) (*FrontmatterResult, bool) { |
| 70 | v, ok := builtinFrontmatterCache.Load(path) |
| 71 | if !ok { |
| 72 | virtualFsLog.Printf("Frontmatter cache miss: path=%s", path) |
| 73 | return nil, false |
| 74 | } |
| 75 | result, ok := v.(*FrontmatterResult) |
| 76 | if !ok { |
| 77 | virtualFsLog.Printf("Frontmatter cache type mismatch for %s: got %T", path, v) |
| 78 | builtinFrontmatterCache.Delete(path) |
| 79 | return nil, false |
| 80 | } |
| 81 | virtualFsLog.Printf("Frontmatter cache hit: path=%s", path) |
| 82 | return result, true |
| 83 | } |
| 84 | |
| 85 | // SetBuiltinFrontmatterCache stores a FrontmatterResult for a builtin virtual file. |
| 86 | // The stored result becomes shared and read-only — callers MUST NOT mutate it |