-
Notifications
You must be signed in to change notification settings - Fork 0
Cache Lifecycle and Performance
Ngan Pham edited this page Feb 24, 2026
·
1 revision
- A fixture is declared in test context.
- FixtureKit generates cache by evaluating fixture definition in adapter isolation.
- FixtureKit records touched models and stores SQL restore statements + exposed ids.
- Each test mounts cache data and rehydrates exposed records through
Repository.
At runner start, FixtureKit clears cache_path by default.
- RSpec start point:
before(:suite) - Minitest start point: class
run_suitebefore first generation
Set FIXTURE_KIT_PRESERVE_CACHE to keep cache files between runs:
FIXTURE_KIT_PRESERVE_CACHE=1 bundle exec rspecTruthy values are case-insensitive: 1, true, yes.
- Cache generation does real app writes once per fixture context.
- Cache mounting replays SQL in batches per connection with referential integrity disabled during replay.
- Repository reads are lazy and memoized per exposed name.