Look up a cached result. Requires `tenant_id` to prevent cross-tenant leaks.
(&self, tenant_id: u64, partition_id: i64, query_hash: u64)
| 41 | |
| 42 | /// Look up a cached result. Requires `tenant_id` to prevent cross-tenant leaks. |
| 43 | pub fn get(&self, tenant_id: u64, partition_id: i64, query_hash: u64) -> Option<&[u8]> { |
| 44 | self.entries |
| 45 | .get(&(tenant_id, partition_id, query_hash)) |
| 46 | .map(|v| v.as_slice()) |
| 47 | } |
| 48 | |
| 49 | /// Insert a result into the cache. Evicts old entries if over budget. |
| 50 | pub fn insert(&mut self, tenant_id: u64, partition_id: i64, query_hash: u64, result: Vec<u8>) { |