MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / expire_sets_ttl

Function expire_sets_ttl

nodedb/src/engine/kv/engine.rs:449–459  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

447
448 #[test]
449 fn expire_sets_ttl() {
450 let mut e = make_engine();
451 let n = now();
452
453 e.put(1, "cache", b"k", b"v", 0, n, Surrogate::ZERO);
454 assert!(e.get(1, "cache", b"k", n + 100_000).is_some()); // No TTL.
455
456 assert!(e.expire(1, "cache", b"k", 2000, n));
457 assert!(e.get(1, "cache", b"k", n + 1999).is_some());
458 assert!(e.get(1, "cache", b"k", n + 2000).is_none()); // Expired.
459 }
460
461 #[test]
462 fn batch_get_and_put() {

Callers

nothing calls this directly

Calls 3

nowFunction · 0.85
make_engineFunction · 0.70
putMethod · 0.45

Tested by

no test coverage detected