Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUST-2006 Add option to configure DEK cache lifetime #38

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions mongocrypt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self> {
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<Crypt> {
let _guard = CRYPT_LOCK.lock().unwrap();

Expand Down