Validate the cache for a given object. If the object fingerprint is different, the cache is invalidated and the value is removed.
(&self, uid: &str, object: &Object)
| 115 | /// If the object fingerprint is different, the cache is invalidated and the |
| 116 | /// value is removed. |
| 117 | pub async fn validate_cache(&self, uid: &str, object: &Object) -> DbResult<()> { |
| 118 | if let Some(cached_object) = self.inner.get(uid).await { |
| 119 | if cached_object.fingerprint() != self.fingerprint(object)? { |
| 120 | trace!("Invalidating the cache for {}", uid); |
| 121 | self.inner.invalidate(uid).await; |
| 122 | } |
| 123 | } |
| 124 | Ok(()) |
| 125 | } |
| 126 | |
| 127 | /// Clear a value from the cache. |
| 128 | pub async fn clear_cache(&self, uid: &str) { |
nothing calls this directly
no test coverage detected