diff --git a/Cargo.toml b/Cargo.toml index adf135a..4b399b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" [dependencies] askama = { version = "0.11.1", default-features = false } async-recursion = "1.0.0" -cached = "0.40.0" +cached = { version = "0.40.0", optional = true } clap = { version = "4.0.18", default-features = false, features = ["std"] } regex = "1.6.0" serde = { version = "1.0.147", features = ["derive"] } @@ -25,3 +25,6 @@ tokio = { version = "1.21.2", features = ["full"] } time = "0.3.16" url = "2.3.1" rust-embed = { version = "6.4.2", features = ["include-exclude"] } + +[features] +default = ["cached"] diff --git a/src/client.rs b/src/client.rs index da271dd..c9c017a 100644 --- a/src/client.rs +++ b/src/client.rs @@ -112,7 +112,7 @@ fn request(url: String, quarantine: bool) -> Boxed, String } // Make a request to a Reddit API and parse the JSON response -#[cached(size = 100, time = 30, result = true)] +#[cfg_attr(feature = "cached", cached(size = 100, time = 30, result = true))] pub async fn json(path: String, quarantine: bool) -> Result { // Build Reddit url from path let url = format!("https://www.reddit.com{}", path);