aboutsummaryrefslogtreecommitdiff
path: root/src/cache/mod.rs
diff options
context:
space:
mode:
authorErk- <[email protected]>2018-10-15 19:59:49 +0200
committerLakelezz <[email protected]>2018-10-15 19:59:49 +0200
commitb2362dbb0014781bd7757a9e322ae3b8d5f2fadf (patch)
treedb77d2842f5320c39b0d1a957b6e4394dcc994e4 /src/cache/mod.rs
parentFix Default Command to inherit Group-Options (#412) (diff)
downloadserenity-b2362dbb0014781bd7757a9e322ae3b8d5f2fadf.tar.xz
serenity-b2362dbb0014781bd7757a9e322ae3b8d5f2fadf.zip
Add configuration for the write lock the cache is using to update (#415)
Diffstat (limited to 'src/cache/mod.rs')
-rw-r--r--src/cache/mod.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/cache/mod.rs b/src/cache/mod.rs
index 780c364..f02d1c6 100644
--- a/src/cache/mod.rs
+++ b/src/cache/mod.rs
@@ -52,7 +52,8 @@ use std::collections::{
};
use std::{
default::Default,
- sync::Arc
+ sync::Arc,
+ time::Duration,
};
mod cache_update;
@@ -756,6 +757,15 @@ impl Cache {
e.update(self)
}
+ /// Gets the duration it will try for when acquiring a write lock.
+ ///
+ /// Refer to the documentation for [`cache_lock_time`] for more information.
+ ///
+ /// [`cache_lock_time`]: struct.Settings.html#method.cache_lock_time
+ pub fn get_try_write_duration(&self) -> Option<Duration> {
+ self.settings.cache_lock_time
+ }
+
pub(crate) fn update_user_entry(&mut self, user: &User) {
match self.users.entry(user.id) {
Entry::Vacant(e) => {