diff --git a/mongocrypt/src/lib.rs b/mongocrypt/src/lib.rs index 49627dc..ccb6100 100644 --- a/mongocrypt/src/lib.rs +++ b/mongocrypt/src/lib.rs @@ -259,6 +259,17 @@ impl CryptBuilder { Ok(self) } + /// Set the expiration time for the data encryption key cache. Defaults to 60 seconds if not set. + pub fn key_cache_expiration(self, expiration_ms: u64) -> Result { + unsafe { + let ok = sys::mongocrypt_setopt_key_expiration(*self.inner.borrow(), expiration_ms); + if !ok { + return Err(self.status().as_error()) + } + } + Ok(self) + } + pub fn build(mut self) -> Result { let _guard = CRYPT_LOCK.lock().unwrap();