Skip to content

v0.11.1

Choose a tag to compare

@javaquasar javaquasar released this 02 Jun 11:47
· 204 commits to main since this release

HydraCache 0.11.1 Release Notes

HydraCache 0.11.1 is a patch release for public documentation and crate
metadata. It does not change runtime behavior or public API semantics.

Highlights

  • Clarified that CacheEntity and HydraCacheEntity belong to the
    database-neutral hydracache-db layer.
  • Kept the hydracache-sqlx re-exports supported as adapter convenience for
    SQLx users.
  • Updated README examples to show the canonical import boundary.
  • Documented that publishing smoke tests may intentionally import through
    hydracache-sqlx when verifying adapter re-exports.

Canonical Entity Import

Use hydracache-db for database-neutral entity metadata:

use hydracache_db::{CacheEntity, HydraCacheEntity};
use hydracache_sqlx::DbCache;

#[derive(serde::Serialize, serde::Deserialize, HydraCacheEntity)]
#[hydracache(entity = "user", collection = "users", id = i64)]
struct User {
    id: i64,
    name: String,
}

# async fn example(queries: DbCache) -> hydracache_sqlx::Result<()> {
let user = queries
    .for_entity::<User>(42)
    .fetch_with(|| async {
        Ok::<_, std::io::Error>(User {
            id: 42,
            name: "Ada".to_owned(),
        })
    })
    .await?;

assert_eq!(user.id, 42);
assert_eq!(User::cache_key_for(&42), "user:42");
assert_eq!(User::collection_tag(), Some("users".to_owned()));
# Ok(())
# }

hydracache-sqlx::{CacheEntity, HydraCacheEntity} remains valid for users who
want to depend only on the SQLx adapter crate in application code.

Publish Order

Publish in dependency order:

  1. hydracache-core
  2. hydracache
  3. hydracache-macros
  4. hydracache-db
  5. hydracache-sqlx

Wait for crates.io index propagation between dependent crates.