Class: Rigor::Cache::RbsInstanceDefinitions

Inherits:
Object
  • Object
show all
Defined in:
lib/rigor/cache/rbs_instance_definitions.rb

Overview

Cache producer that materialises the full ‘Hash<String, RBS::Definition>` for instance-side class definitions in the RBS environment, in a single cache entry. Mirrors the RbsConstantTable layout.

ADR-7 § “Slice 6-D” carry-over and dogfooding feedback: the earlier per-class cache layout (one entry per class, ~1300 files) made warm runs slower than ‘–no-cache` because each `instance_definition` call paid disk-open + `Marshal.load` overhead and the in-memory `RBS::DefinitionBuilder.build_instance` was actually fast given a cached `RBS::Environment`. The single-blob layout collapses that to one `Marshal.load` per process; warm runs now match `–no-cache` timing while preserving the cross-process invalidation story.

Marshal-cleanness of ‘RBS::Definition` is enabled by the v0.0.9 C2 `RBS::Location` patch.

Constant Summary collapse

PRODUCER_ID =
"rbs.instance_definitions"

Class Method Summary collapse

Class Method Details

.fetch(loader:, store:) ⇒ Hash{String => RBS::Definition}

Parameters:

Returns:

  • (Hash{String => RBS::Definition})


32
33
34
35
36
37
# File 'lib/rigor/cache/rbs_instance_definitions.rb', line 32

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