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

Function test_basic_cache_operations

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

insertMethod · 0.45
statsMethod · 0.45

Tested by

no test coverage detected