PERSIST: remove TTL from a key. Returns true if the key was found.
(&mut self, tenant_id: u64, collection: &str, key: &[u8])
| 214 | |
| 215 | /// PERSIST: remove TTL from a key. Returns true if the key was found. |
| 216 | pub fn persist(&mut self, tenant_id: u64, collection: &str, key: &[u8]) -> bool { |
| 217 | let tkey = table_key(tenant_id, collection); |
| 218 | let table = match self.tables.get_mut(&tkey) { |
| 219 | Some(t) => t, |
| 220 | None => return false, |
| 221 | }; |
| 222 | |
| 223 | if let Some(meta) = table.get_entry_meta(key) |
| 224 | && meta.has_ttl |
| 225 | { |
| 226 | let composite = expiry_key(tenant_id, collection, key); |
| 227 | self.expiry.cancel(&composite, meta.expire_at_ms); |
| 228 | } |
| 229 | |
| 230 | table.persist(key) |
| 231 | } |
| 232 | } |
no test coverage detected