Skip to content

v0.12.0

Choose a tag to compare

@josepdcs josepdcs released this 28 Nov 12:23
· 5 commits to main since this release
a9aa94f

🔥 Smart Cache Invalidation!

Version 0.12.0 introduces intelligent cache invalidation mechanisms beyond simple TTL expiration:

New Features:

  • 🏷️ Tag-Based Invalidation - Group related caches and invalidate them together
  • 📡 Event-Driven Invalidation - Trigger invalidation when application events occur
  • 🔗 Dependency-Based Invalidation - Cascade invalidation to dependent caches
  • 🎯 Manual Invalidation - Invalidate specific caches by name
  • 🔄 Flexible Combinations - Use tags, events, and dependencies together
  • Zero Overhead - No performance impact when not using invalidation
  • 🔒 Thread-Safe - All operations are atomic and concurrent-safe

Quick Start:

use cachelito::{cache, invalidate_by_tag, invalidate_by_event};

// Tag-based grouping
#[cache(tags = ["user_data", "profile"], name = "get_user_profile")]
fn get_user_profile(user_id: u64) -> UserProfile {
    fetch_from_db(user_id)
}

// Event-driven invalidation
#[cache(events = ["user_updated"], name = "get_user_settings")]
fn get_user_settings(user_id: u64) -> Settings {
    fetch_settings(user_id)
}

// Invalidate all user_data caches
invalidate_by_tag("user_data");

// Invalidate on event
invalidate_by_event("user_updated");

See also: examples/smart_invalidation.rs

What's Changed

Full Changelog: 0.11.0...0.12.0