| 683 | |
| 684 | #[test] |
| 685 | fn test_basic_cache_operations() { |
| 686 | let cache = TtlCache::new(); |
| 687 | |
| 688 | // Insert and retrieve |
| 689 | cache.insert("key1".to_string(), "value1".to_string()); |
| 690 | assert_eq!(cache.get(&"key1".to_string()), Some("value1".to_string())); |
| 691 | assert_eq!(cache.get(&"nonexistent".to_string()), None); |
| 692 | |
| 693 | // Check stats |
| 694 | let stats = cache.stats(); |
| 695 | assert_eq!(stats.hits, 1); |
| 696 | assert_eq!(stats.misses, 1); |
| 697 | assert_eq!(stats.insertions, 1); |
| 698 | } |
| 699 | |
| 700 | #[test] |
| 701 | fn test_ttl_expiration() { |