HydraCache 0.33.0
HydraCache 0.33.0
0.33.0 focuses on production ergonomics after the 0.32.0 database adapter
parity release.
Planned Highlights
- Policy presets for common cache intent: short-lived values, read-mostly
values, per-entity values, explicit-invalidation-only values, and negative
cache entries. - Refresh/stale options for serving recently expired values while a reload is
running or when a loader temporarily fails. - Shared database-neutral refresh behavior for SQLx, Diesel, SeaORM, and custom
repository loaders. - Production guidance for keys, tags, TTLs, stale behavior, invalidation, and
observability. - Soft cleanup tooling for generated release/test target directories.
Changes
- Added
QueryCachePolicyandPreparedQueryPolicypresets:
short_lived,read_mostly,per_entity,
no_ttl_explicit_invalidation, andnegative_cache. - Added
PreparedQueryPolicy::cache_entity::<T>()so prepared presets can be
combined withHydraCacheEntitymetadata without rebuilding the policy from
scratch. - Added
RefreshOptionsandHydraCache::get_or_load_with_refreshfor
refresh_ahead,stale_while_revalidate, and bounded
stale_on_loader_errorbehavior on local loader-based cache reads. - Added database-neutral
RefreshPolicysupport onQueryCachePolicy,
PreparedQueryPolicy,DbQuery, and adapter re-exports so SQLx, Diesel,
SeaORM, and custom repository loaders share the same stale/refresh behavior. - Added
docs/PRODUCTION_GUIDE.mdfor keys/tags, presets, refresh behavior,
invalidation safety, and observability guidance. - Added
scripts/clean-generated-targets.ps1for safely removing generated
release/check target directories without a fullcargo clean. - Reduced one refresh-path allocation by checking stale-window eligibility
before cloning expired entries for error fallback.
Verification
This release should pass:
cargo fmt --all -- --checkcargo check --workspace --all-targets --lockedcargo test --workspace --all-targets --lockedcargo clippy --workspace --all-targets --all-features --locked -- -D warningscargo test --doc --workspace --lockedRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --locked.\scripts\package-publishable.ps1 -Set bootstrap -AllowDirty.\scripts\verify-crates-io-consumer.ps1 -Version 0.33.0