()
| 772 | |
| 773 | #[test] |
| 774 | fn test_cache_clear() { |
| 775 | let cache = TtlCache::new(); |
| 776 | |
| 777 | cache.insert("key1".to_string(), "value1".to_string()); |
| 778 | cache.insert("key2".to_string(), "value2".to_string()); |
| 779 | |
| 780 | assert_eq!(cache.len(), 2); |
| 781 | |
| 782 | cache.clear(); |
| 783 | |
| 784 | assert_eq!(cache.len(), 0); |
| 785 | assert!(cache.is_empty()); |
| 786 | } |
| 787 | |
| 788 | #[test] |
| 789 | fn test_ttl_extension() { |