Get entry metadata without returning the value. Returns the TTL state and expiry timestamp for a key, used by the KV engine to cancel old expiry entries before updates. Does NOT check expiry — returns metadata even for expired keys, since the caller needs the original `expire_at_ms` for cancellation.
(&self, key: &[u8])
| 54 | /// Does NOT check expiry — returns metadata even for expired keys, |
| 55 | /// since the caller needs the original `expire_at_ms` for cancellation. |
| 56 | pub fn get_entry_meta(&self, key: &[u8]) -> Option<EntryMeta> { |
| 57 | let h = hash_key(key); |
| 58 | |
| 59 | if let Some(entry) = self.probe_find(&self.slots, h, key) { |
| 60 | return Some(EntryMeta { |
| 61 | has_ttl: entry.has_ttl(), |
| 62 | expire_at_ms: entry.expire_at_ms, |
| 63 | }); |
| 64 | } |
| 65 | |
| 66 | if let Some(old) = &self.rehash_source |
| 67 | && let Some(entry) = self.probe_find(old, h, key) |
| 68 | { |
| 69 | return Some(EntryMeta { |
| 70 | has_ttl: entry.has_ttl(), |
| 71 | expire_at_ms: entry.expire_at_ms, |
| 72 | }); |
| 73 | } |
| 74 | |
| 75 | None |
| 76 | } |
| 77 | |
| 78 | /// Insert or update a key-value pair. Returns the old value bytes if overwritten. |
| 79 | /// |