()
| 787 | |
| 788 | #[test] |
| 789 | fn test_ttl_extension() { |
| 790 | let cache = TtlCache::new(); |
| 791 | |
| 792 | cache.insert_with_ttl("key1".to_string(), "value1".to_string(), Duration::from_millis(100)); |
| 793 | |
| 794 | // Extend TTL |
| 795 | assert!(cache.extend_ttl(&"key1".to_string(), Duration::from_millis(100))); |
| 796 | assert!(!cache.extend_ttl(&"nonexistent".to_string(), Duration::from_millis(100))); |
| 797 | |
| 798 | // Wait for original TTL |
| 799 | thread::sleep(Duration::from_millis(150)); |
| 800 | |
| 801 | // Should still be available due to extension |
| 802 | assert_eq!(cache.get(&"key1".to_string()), Some("value1".to_string())); |
| 803 | } |
| 804 | |
| 805 | #[test] |
| 806 | fn test_entries_expiring_within() { |
nothing calls this directly
no test coverage detected