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
//! Content Caching Implementation
//!
//! Provides in-memory caching for API responses with TTL and size limits.
//!
//! ## Features
//!
//! - **TTL Support**: Automatic expiration of cached entries
//! - **Size Limits**: Maximum cache size with LRU eviction
//! - **Thread-Safe**: Safe for concurrent use
//! - **Statistics**: Track hits, misses, and cache size
//! - **Generic**: Works with any serializable types
//!
//! ## Usage
//!
//! ```no_run
//! # use api_huggingface::cache::{Cache, CacheConfig};
//! # use std::time::Duration;
//! # async fn example() -> Result< (), Box< dyn std::error::Error > > {
//! let cache = Cache::new(CacheConfig {
//! max_entries : 1000,
//! default_ttl : Some(Duration::from_secs(300)),
//! });
//!
//! // Cache a value
//! cache.insert("key".to_string(), "value".to_string(), None).await;
//!
//! // Retrieve from cache
//! if let Some(value) = cache.get(&"key".to_string()).await {
//! println!("Cache hit : {}", value);
//! }
//! # Ok(())
//! # }
//! ```
pub use ;