R/utils_cache_clear.R

Defines functions clear_cache

Documented in clear_cache

#' Clear function cache
#'
#' This function clears the memoised cache of all functions memoised by `nflreadr`.
#'
#' @rdname clear_cache
#' @export
#' @return A success message after clearing the cache.
#' @examples
#' clear_cache()
clear_cache <- function(){

  functions <- list(
    raw_from_url,
    csv_from_url,
    rds_from_url,
    qs_from_url
  )

  lapply(functions, memoise::forget)

  cli::cli_alert_success("nflreadr function cache cleared!")

  invisible(TRUE)
}

#' @rdname clear_cache
#' @export
.clear_cache <- clear_cache

Try the nflreadr package in your browser

Any scripts or data that you put into this service are public.

nflreadr documentation built on Sept. 8, 2023, 5:57 p.m.