Class: Rigor::Cache::RbsKnownClassNames
- Inherits:
-
Object
- Object
- Rigor::Cache::RbsKnownClassNames
- Defined in:
- lib/rigor/cache/rbs_known_class_names.rb
Overview
Cache producer that materialises the set of every RBS-declared class / module / alias name (top-level prefixed, e.g. ‘“::Math”`) currently loaded into the environment. Marshal- clean — the cache value is a `Set<String>`.
The set lets ‘RbsLoader#class_known?` answer point lookups in O(1) without re-parsing the name on each call, and lets a warm process skip the env walk entirely (the env still has to be built to enumerate decls on cold misses; subsequent processes sharing the Store load the set straight from disk).
Cache descriptor shape is shared with RbsConstantTable via Rigor::Cache::RbsDescriptor.build; a single signature change or rbs gem bump invalidates both producers in lockstep.
Constant Summary collapse
- PRODUCER_ID =
"rbs.known_class_names"
Class Method Summary collapse
Class Method Details
.fetch(loader:, store:) ⇒ Set<String>
27 28 29 30 31 32 |
# File 'lib/rigor/cache/rbs_known_class_names.rb', line 27 def self.fetch(loader:, store:) descriptor = RbsDescriptor.build(loader) store.fetch_or_compute(producer_id: PRODUCER_ID, params: {}, descriptor: descriptor) do compute(loader) end end |