Skip to content

Commit

Permalink
Only include cache::Settings::time_to_live if temp cache is enabled (
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev authored and mkrasnitski committed Jan 31, 2025
1 parent 20fc1a1 commit e199c94
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/cache/settings.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::time::Duration;

/// Settings for the cache.
///
/// # Examples
Expand All @@ -16,14 +14,15 @@ use std::time::Duration;
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct Settings {
/// How long temporarily-cached data should be stored before being thrown out.
///
/// Defaults to one hour.
#[cfg(feature = "temp_cache")]
pub time_to_live: std::time::Duration,
/// The maximum number of messages to store in a channel's message cache.
///
/// Defaults to 0.
pub max_messages: usize,
/// How long temporarily-cached data should be stored before being thrown out.
///
/// Defaults to one hour.
pub time_to_live: Duration,
/// Whether to cache guild data received from gateway.
///
/// Defaults to true.
Expand All @@ -41,8 +40,9 @@ pub struct Settings {
impl Default for Settings {
fn default() -> Self {
Self {
#[cfg(feature = "temp_cache")]
time_to_live: std::time::Duration::from_secs(60 * 60),
max_messages: 0,
time_to_live: Duration::from_secs(60 * 60),
cache_guilds: true,
cache_channels: true,
cache_users: true,
Expand Down

0 comments on commit e199c94

Please sign in to comment.