class CodeLocator
- CodeLocator
- Reference
- Object
Defined in:
models/code_locator.crConstant Summary
-
DEFAULT_CONTENT_CACHE_BUDGET =
(512_i64 * 1024) * 1024 -
Default content cache budget (bytes). Override via
NOIR_CONTENT_CACHE_MAX_MB(value in megabytes). Set to 0 or the envNOIR_CONTENT_CACHE_DISABLE=trueto disable caching entirely, in which case#content_foralways returns nil and analyzers fall through toFile.read.
Constructors
Instance Method Summary
- #all(key : String) : Array(String)
-
#build_extension_index
Build extension index from file_map for fast lookups
- #clear(key : String)
- #clear_all
- #content_cache_stats : NamedTuple(bytes: Int64, files: Int32, skipped: Int32, budget: Int64)
-
#content_for(path : String) : String | Nil
Returns cached file content or
nilif the file was not cached (budget exhausted, caching disabled, or read after cache was cleared). -
#file_usage_stats : Hash(String, Int32)
Get file usage statistics
-
#files_by_extension(extension : String) : Array(String)
Get files by extension using the index (O(1) lookup)
- #get(key : String) : String | Array(String)
- #push(key : String, value : String)
-
#register_file(path : String, content : String)
One-shot used by the detector's file reader: push the path into
file_mapand (budget permitting) cache the content so analyzers can skip the secondFile.read. - #set(key : String, value : String)
-
#show_file_stats
Show file usage statistics
- #show_table
Constructor Detail
Instance Method Detail
Returns cached file content or nil if the file was not cached
(budget exhausted, caching disabled, or read after cache was
cleared). Callers should fall back to File.read on nil.
Get files by extension using the index (O(1) lookup)
One-shot used by the detector's file reader: push the path into
file_map and (budget permitting) cache the content so analyzers
can skip the second File.read. Files whose content exceeds the
remaining budget are still registered in file_map but not cached,
and #content_for(path) returns nil for them — callers must keep
a File.read fallback.