R/cache.R

Defines functions cache_get cache_add cache_clear

Documented in cache_clear

.cache <- new.env(TRUE)

#' clears the cache
#' 
#' @export
cache_clear <- function(){
  rm( list  = ls(envir=.cache)
    , envir = .cache
    )
}

cache_add <- function(url, result){
  .cache[[url]] <- result
  result
}

cache_get <- function(url){
  .cache[[url]]
}

Try the cbsodataR package in your browser

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

cbsodataR documentation built on May 29, 2024, 8:40 a.m.