Skip to content

Commit

Permalink
fetch: add an 2M element LRU memoize cache to process_jql()
Browse files Browse the repository at this point in the history
jql queries against the same JSON string are prime candidates for caching as the results are deterministic.
  • Loading branch information
jqnatividad committed Nov 29, 2023
1 parent ad5b9bc commit e065d95
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cmd/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,12 @@ impl From<jql_runner::errors::JqlRunnerError> for CliError {
}
}

#[inline]
#[cached(
size = 2_000_000,
key = "String",
convert = r#"{ format!("{}-{}", json, query) }"#,
result = true
)]
pub fn process_jql(json: &str, query: &str) -> CliResult<String> {
let mut deserializer = serde_json::Deserializer::from_str(json);

Expand Down

0 comments on commit e065d95

Please sign in to comment.