Skip to content

Commit

Permalink
geocode: optimize cached keys
Browse files Browse the repository at this point in the history
we don't need lang-lookup as that is unchanging per invocation
  • Loading branch information
jqnatividad committed Nov 19, 2023
1 parent 04c6e74 commit 395f637
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/cmd/geocode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ async fn load_engine(geocode_index_file: PathBuf, progressbar: &ProgressBar) ->
create = "{ SizedCache::try_with_size(CACHE_SIZE).unwrap_or_else(|_| \
SizedCache::with_size(FALLBACK_CACHE_SIZE)) }",
key = "String",
convert = r#"{ format!("{cell}-{lang_lookup}") }"#,
convert = r#"{ cell.to_owned() }"#,
option = true
)]
fn search_index(
Expand Down Expand Up @@ -2053,10 +2053,7 @@ fn get_countryinfo(
/// Note that the index file needs to be built with the desired languages for this to work.
/// Use the "index-update" subcommand with the --languages option to rebuild the index
/// with the desired languages. Otherwise, all names will be in English (en)
#[cached(
key = "String",
convert = r#"{ format!("{}-{}", cityrecord.id, lang_lookup) }"#
)]
#[cached(key = "String", convert = r#"{ format!("{}", cityrecord.id) }"#)]
fn get_cityrecord_name_in_lang(cityrecord: &CitiesRecord, lang_lookup: &str) -> NamesLang {
let cityname = cityrecord
.names
Expand Down

0 comments on commit 395f637

Please sign in to comment.