Skip to content

v0.15.0

Latest

Choose a tag to compare

@javaquasar javaquasar released this 08 Jun 22:35
· 197 commits to main since this release

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 = ... to cacheable!(...).
  • Kept repeated tag = ... support and allowed it to combine with tags = ....
  • Added cacheable_infallible!(...) for loaders that return a value directly
    instead of Result<T, E>.
  • Re-exported cacheable_infallible! from the base hydracache crate.
  • Expanded README and cargo-doc examples for tags = ..., TagSet, and
    cacheable_infallible!(...).
  • Added crates/hydracache/examples/cacheable_function.rs as 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 and Ok::<_, 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 -- --check
  • cargo check --workspace --all-targets --locked
  • cargo test --workspace --all-targets --locked
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • cargo test --doc --workspace --locked
  • cargo doc --workspace --no-deps --locked
  • cargo run -p hydracache --example cacheable_function --locked
  • cargo llvm-cov --workspace --all-targets --locked --summary-only
  • cargo 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.