MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_ttl_extension

Function test_ttl_extension

src/cache/ttl_cache.rs:789–803  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 1

insert_with_ttlMethod · 0.80

Tested by

no test coverage detected