-
Notifications
You must be signed in to change notification settings - Fork 0
Cache Keys and Invalidation
Understanding what invalidates cache entries helps avoid surprise full rebuilds or stale skips.
A step cache hit fails (step runs again) when any of these change:
| Trigger | What changed |
|---|---|
| Input files | Content (key) or size/mtime (index) of files matched by input/mutate
|
| Outputs missing | Declared output path deleted or not found |
| Shell command |
run string text |
build.lua |
Content hash (for Lua callback steps) |
| Step config |
config table / configure_step() / task overlay |
| Environment | Any variable in env.hash_vars (unless in ignore_vars_for_hashing) |
| Beez upgrade | Version string in key and index |
--no-cache |
Cache disabled for run |
--dry-run |
Lookups skipped (steps not executed anyway) |
- Changing an unrelated file outside
input/mutateglobs - Vars not listed in
env.hash_vars - Renaming the step's
phaseorscope(treated as a different step with a separate index file)
A file_success_cached hit fails when:
| Trigger | Effect |
|---|---|
| File content changes |
file_hash mismatch |
| Included headers change |
inputs_hash mismatch (via #include "..." scan) |
| File deleted | Not a regular file anymore |
| Step config changes |
config_hash mismatch |
| Revision bump | e.g. lint_rev = "3"
|
| Beez upgrade |
version mismatch |
| Previous failure | Path listed in misses file (re-checked via get_cache_misses) |
Generic success_cached(key) invalidates when config, version, or key identity changes (no file hash).
Add explicit revision fields to step config when tooling changes without source changes:
configure_step("lint", {
patterns = { "src/**/*.cpp" },
lint_rev = "1",
})
configure_step("format", {
patterns = { "src/**/*.cpp" },
format_rev = "1",
})Bump the revision when:
-
.clang-tidyor formatter config changes - Lint rule sets change
- Docker image or tool version changes (if not captured in env vars)
Vars in env.hash_vars are sorted and concatenated into a fingerprint string for step cache keys.
Default hashed vars: CC, CXX, CFLAGS, CXXFLAGS, LDFLAGS, BUILD_TYPE.
Add custom vars when they affect build output:
env = {
hash_vars = {
"CC", "CXX", "BUILD_TYPE", "MY_TOOLCHAIN",
},
},Exclude noisy session vars via ignore_vars_for_hashing.
Both caches embed the Beez version. Upgrading Beez invalidates existing entries. This is intentional when cache format or logic changes.
| Action | Effect |
|---|---|
beez --clean-cache |
Deletes entire cache root |
Delete .cache/success/ only |
Clears success cache, keeps step cache |
Delete .cache/index/
|
Forces step cache to recompute via content keys |
rm .cache/index/my-step__*__*.index |
Invalidate one step's fast index |
Step cache requires outputs to exist on disk. If someone deletes build/app but cache index remains, Beez runs the step again even when inputs are unchanged.
Success cache re-hashes file content on every file_success_cached check.
-
Cache Storage and Maintenance -
--update, compression - Caching Troubleshooting
- Environment Variables
Quick Reference · Glossary · FAQ
- Fundamentals
- Core Concepts
- Project Layout
- First Pipeline
- Phases and Scopes
- How Phases and Scopes Work
- Selecting with Phases and Scopes
- Designing Phases and Scopes
- Parallel Execution and Dependencies
- Configuration
- Configuration Overview
- Global User Config
- Project Config
- Environment Variables
- Performance Settings
- Cache Settings
- Config Reference
- CLI
- CLI Overview
- Running Targets
- Filtering by Phase
- Running a Single Step
- Listing Entities
- Output and Logging Flags
- Cache and Maintenance Flags
- Meta and Utility Commands
-
Project Scaffolding —
beez --init(embedded Tempify) - CLI Flag Reference
- Lua DSL
- DSL Overview
- Plugin System — Plugins, Config DSL, Standard-Workflows
- Step Declaration
- Task Declaration
- Workflow Declaration
- Order Declaration
- Configure Step
- ReqPack Declaration
- Beez API
- Step Context
- DSL Patterns
- Caching
- Caching Overview
- Step Cache
- Success Cache
- Glob Metadata Cache
- Artifact Patterns
- Cache Keys and Invalidation
- Cache Storage and Maintenance
- Caching Troubleshooting
- UI and Output
- Output Modes
- Progress and Animation
- Colors and Themes
- Run Summaries
- Logging and Log Files
- Development and Contribution
- Building and Setup
- Repository Layout
- Testing
- Code Quality
- Feature Development Workflow
- Submitting Changes