()
| 699 | |
| 700 | #[test] |
| 701 | fn test_ttl_expiration() { |
| 702 | let cache = TtlCache::new(); |
| 703 | |
| 704 | // Insert with short TTL |
| 705 | cache.insert_with_ttl("key1".to_string(), "value1".to_string(), Duration::from_millis(50)); |
| 706 | |
| 707 | // Should be available immediately |
| 708 | assert_eq!(cache.get(&"key1".to_string()), Some("value1".to_string())); |
| 709 | |
| 710 | // Wait for expiration |
| 711 | thread::sleep(Duration::from_millis(100)); |
| 712 | |
| 713 | // Should be expired |
| 714 | assert_eq!(cache.get(&"key1".to_string()), None); |
| 715 | |
| 716 | let stats = cache.stats(); |
| 717 | assert_eq!(stats.expired_evictions, 1); |
| 718 | } |
| 719 | |
| 720 | #[test] |
| 721 | fn test_max_entries_eviction() { |
nothing calls this directly
no test coverage detected