diff --git a/app/dashboard.Rmd b/app/dashboard.Rmd index ccedd23..f128af9 100644 --- a/app/dashboard.Rmd +++ b/app/dashboard.Rmd @@ -41,8 +41,15 @@ library(shinyWidgets) library(paletteer) library(shinyjs) +APP_DIR <- getwd() + +cache_dir <- file.path(APP_DIR, "cache") +cache_logfile <- file.path(APP_DIR, "cachelog") + source(file = "queries.R") +shinyOptions(cache = cachem::cache_disk(dir = cache_dir, max_age = 86400, evict = "lru", logfile = cache_logfile)) + useShinyjs() # pull static data diff --git a/app/queries.R b/app/queries.R index c95e6d5..5196c29 100644 --- a/app/queries.R +++ b/app/queries.R @@ -632,45 +632,16 @@ query_cache <- cachem::cache_disk( logfile = cache_logfile ) -get_yearly_economics <- memoise(get_yearly_economics, cache = query_cache) get_latest_normalization_year <- memoise( get_latest_normalization_year, cache = query_cache ) -get_yearly_usa_pop_hu <- memoise(get_yearly_usa_pop_hu, cache = query_cache) -get_best_track_summary <- memoise(get_best_track_summary, cache = query_cache) -get_hurdat_id <- memoise(get_hurdat_id, cache = query_cache) get_all_loss_storms <- memoise(get_all_loss_storms, cache = query_cache) get_all_hurdat_ids <- memoise(get_all_hurdat_ids, cache = query_cache) get_latest_aggregate_losses <- memoise( get_latest_aggregate_losses, cache = query_cache ) -get_latest_aggregate_loss <- memoise( - get_latest_aggregate_loss, - cache = query_cache -) -get_unique_lf_ids <- memoise(get_unique_lf_ids, cache = query_cache) -get_normalized_cost_index <- memoise( - get_normalized_cost_index, - cache = query_cache -) -get_all_normalized_cost_index <- memoise( - get_all_normalized_cost_index, - cache = query_cache -) -get_hurdat_landfalls <- memoise(get_hurdat_landfalls, cache = query_cache) get_all_conus_landfalls <- memoise(get_all_conus_landfalls, cache = query_cache) get_all_hurdat_tracks <- memoise(get_all_hurdat_tracks, cache = query_cache) -get_hurdat_track <- memoise(get_hurdat_track, cache = query_cache) -get_normalized_metric_growth <- memoise( - get_normalized_metric_growth, - cache = query_cache -) -get_all_lf_type_landfalls <- memoise( - get_all_lf_type_landfalls, - cache = query_cache -) get_all_lf_type_factors <- memoise(get_all_lf_type_factors, cache = query_cache) -get_lf_type_factors <- memoise(get_lf_type_factors, cache = query_cache) -get_county_and_state <- memoise(get_county_and_state, cache = query_cache)