Class: Rigor::Cache::RbsEnvironment
- Inherits:
-
Object
- Object
- Rigor::Cache::RbsEnvironment
- Defined in:
- lib/rigor/cache/rbs_environment.rb
Overview
Cache producer that materialises the entire ‘RBS::Environment` (the loader’s ‘build_env` result) and round-trips it through `Marshal` against the patched `RBS::Location` (see RbsEnvironmentMarshalPatch).
Cold runs pay the full ‘RBS::EnvironmentLoader#load + RBS::Environment.from_loader + resolve_type_names` cost once; warm runs (and a separate loader sharing the same Store) load the marshalled blob and skip the parse / resolve stages entirely. The `RbsConstantTable`, `RbsKnownClassNames`, `RbsClassAncestorTable`, and `RbsClassTypeParamNames` caches still live alongside this producer — their cached values are reached without re-touching env, but when an uncached lookup happens (`instance_method`, `singleton_method`, …) the env produced here is what answers it.
Cache descriptor shape is shared with every other cache producer that depends on the RBS environment — see Rigor::Cache::RbsDescriptor.build.
Constant Summary collapse
- PRODUCER_ID =
"rbs.environment"
Class Method Summary collapse
Class Method Details
.fetch(loader:, store:) ⇒ ::RBS::Environment
35 36 37 38 39 40 |
# File 'lib/rigor/cache/rbs_environment.rb', line 35 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 |