MCPcopy Create free account
hub / github.com/Cosmian/kms / validate_cache

Method validate_cache

crate/server_database/src/core/unwrapped_cache.rs:117–125  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 3

invalidateMethod · 0.80
getMethod · 0.45
fingerprintMethod · 0.45

Tested by

no test coverage detected