HydraCache 0.15.0 Release Notes
HydraCache 0.15.0 improves the explicit local-cache macro API introduced in
0.14.0.
What's New
- Added
tags = ...tocacheable!(...). - Kept repeated
tag = ...support and allowed it to combine withtags = .... - Added
cacheable_infallible!(...)for loaders that return a value directly
instead ofResult<T, E>. - Re-exported
cacheable_infallible!from the basehydracachecrate. - Expanded README and cargo-doc examples for
tags = ...,TagSet, and
cacheable_infallible!(...). - Added
crates/hydracache/examples/cacheable_function.rsas a live example of
cache hit, invalidation, and infallible function caching.
Examples
use hydracache::{cacheable, cacheable_infallible, HydraCache};
# async fn example() -> hydracache::CacheResult<()> {
let cache = HydraCache::local().build();
let value = cacheable!(
cache = cache,
key = "expensive:42",
tags = ["expensive", "expensive:42"],
ttl_secs = 60,
load = || async { Ok::<_, std::io::Error>(42_u64) },
)
.await?;
let total = cacheable_infallible!(
cache = cache,
key = "expensive-total",
tags = ["expensive"],
ttl_secs = 60,
load = || async { 1_u64 },
)
.await?;
assert_eq!(value, 42);
assert_eq!(total, 1);
# Ok(())
# }Why It Matters
This release keeps the macro explicit and local-first while making common call
sites shorter:
- use
tags = [...]when several invalidation tags belong to one value; - use
cacheable_infallible!when the loader cannot fail andOk::<_, E>(...)
would be only ceremony; - keep
cacheable!for fallible async loaders, HTTP calls, filesystem reads,
repository calls, or other application work.
Compatibility
This release is additive. Existing cacheable!, HydraCache, TypedCache,
DbCache, QueryCachePolicy, HydraCacheEntity, SQLx helper, and explicit
runtime APIs remain available.
Validation
Release validation passed:
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 --lockedcargo doc --workspace --no-deps --lockedcargo run -p hydracache --example cacheable_function --lockedcargo llvm-cov --workspace --all-targets --locked --summary-onlycargo package --workspace --allow-dirty --locked
Coverage summary in this local run:
- functions:
97.65% - visible source lines:
99.45% - regions:
97.60%
The 0.15.0 macro/runtime code is covered by parser unit tests, async runtime
tests, and trybuild compile-pass coverage. The lower workspace-level coverage
summary came from the Docker-backed SQLx integration path being skipped in this
local environment.