v0.12.0
🔥 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
- fix: polishing code by @josepdcs in #28
- Add intelligent cache invalidation strategies by @josepdcs in #30
Full Changelog: 0.11.0...0.12.0