Expand description
Backbone Framework Cache Module
Provides caching functionality with Redis and in-memory support.
§Features
- Redis Backend: Distributed caching with Redis
- Memory Backend: In-process caching for development/testing
- TTL Support: Time-to-live for cache entries
- Async/Await: Full async support with tokio
- Generic Types: Cache any serializable data
§Quick Start
use backbone_cache::{Cache, RedisCache};
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)]
struct User {
id: String,
name: String,
}
// Redis cache
let cache = RedisCache::new("redis://localhost:6379").await?;
// Store user in cache
let user = User { id: "123".to_string(), name: "John".to_string() };
cache.set("user:123", &user, Some(3600)).await?;
// Retrieve user from cache
let cached_user: Option<User> = cache.get("user:123").await?;Re-exports§
Modules§
Structs§
- Cache
Config - Cache configuration
- Cache
Key - Cache key builder utilities
Enums§
- Cache
Error - Cache error types
Constants§
- DEFAULT_
TTL - Default cache TTL in seconds (1 hour)
- VERSION
- Cache module version
Type Aliases§
- Cache
Result - Result type for cache operations