1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//! # ThreatFlux Cache
//!
//! A flexible async cache library for Rust with pluggable backends and serialization.
//!
//! ## Features
//!
//! - **Async-first**: Built on tokio for high-performance async operations
//! - **Generic**: Works with any serializable key-value types
//! - **Pluggable backends**: Filesystem, memory, or custom implementations
//! - **Flexible serialization**: JSON, bincode, or custom formats
//! - **Eviction policies**: LRU, LFU, FIFO, TTL-based eviction
//! - **Compression**: Optional compression for stored values
//! - **Search capabilities**: Query cache entries with custom predicates
//! - **Metrics**: Optional Prometheus metrics integration
//!
//! ## Quick Start
//!
//! ```rust
//! use threatflux_cache::{Cache, CacheConfig, MemoryBackend, AsyncCache};
//! use serde::{Serialize, Deserialize};
//!
//! #[derive(Serialize, Deserialize, Clone)]
//! struct MyData {
//! content: String,
//! }
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create a cache with default configuration and memory backend
//! let backend = MemoryBackend::new();
//! let cache = Cache::<String, MyData>::new(CacheConfig::default(), backend).await?;
//!
//! // Store a value
//! cache.put("key1".to_string(), MyData { content: "Hello".to_string() }).await?;
//!
//! // Retrieve a value
//! if let Some(data) = cache.get(&"key1".to_string()).await? {
//! println!("Found: {}", data.content);
//! }
//!
//! Ok(())
//! }
//! ```
// Re-export main types
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use StorageBackend;
// Re-export backend implementations
pub use FilesystemBackend;
pub use MemoryBackend;
/// Prelude module for convenient imports