diff --git a/NAMESPACE b/NAMESPACE index 82e5a625..4fb4819f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -4,6 +4,7 @@ export(filter_properties) export(forget_gemma_memoised) export(gemma_call) export(gemma_kable) +export(gemma_memoise) export(get_all_pages) export(get_child_terms) export(get_dataset_annotations) diff --git a/R/aa_caching.R b/R/aa_caching.R index acee66a0..fd234688 100644 --- a/R/aa_caching.R +++ b/R/aa_caching.R @@ -19,11 +19,17 @@ in_memory_cache <- function(...){ #' Enable and disable memoisation of gemma.R functions #' @param memoised boolean. If TRUE memoisation will be enabled -#' @return Option set for memoisation -#' @keywords internal -gemma_memoise <- function(memoised = NULL){ - options('gemma.memoised' = setting) - getOption('gemma.memoised',FALSE) +#' @param cache File path or "cache_in_memory". File path will chose a location +#' to save the cache files for memoisation. "cache_in_memory" will store the cache +#' in the current R session +#' @return NULL +#' @keywords misc +#' @export +gemma_memoise <- function(memoised = FALSE, + cache = rappdirs::user_cache_dir(appname ='gemmaR')){ + options('gemma.memoised' = memoised) + options('gemma.cache' = cache) + NULL } mem_in_memory_cache <- memoise::memoise(in_memory_cache, cache = memoise::cache_memory()) diff --git a/R/gemma.R.R b/R/gemma.R.R index 3d833c2e..76b3d9f6 100644 --- a/R/gemma.R.R +++ b/R/gemma.R.R @@ -46,4 +46,4 @@ utils::globalVariables(c("platform.ID", "analysis.ID", "analysis.Threshold", "ba "subsetFactor.categoryURI", "subsetFactor.Enabled", "subsetFactor.factorValue", "subsetFactor.factorValueURI", "valueUri", "category", "categoryURI", "experimental.factorValue","value", - "contrast.ID","%$%",'baseline.factors','setting')) + "contrast.ID","%$%",'baseline.factors')) diff --git a/man/gemma_memoise.Rd b/man/gemma_memoise.Rd index cfebe04f..e172a38e 100644 --- a/man/gemma_memoise.Rd +++ b/man/gemma_memoise.Rd @@ -4,15 +4,19 @@ \alias{gemma_memoise} \title{Enable and disable memoisation of gemma.R functions} \usage{ -gemma_memoise(memoised = NULL) +gemma_memoise( + memoised = FALSE, + cache = rappdirs::user_cache_dir(appname = "gemmaR") +) } \arguments{ \item{memoised}{boolean. If TRUE memoisation will be enabled} -} -\value{ -Option set for memoisation + +\item{cache}{File path or "cache_in_memory". File path will chose a location +to save the cache files for memoisation. "cache_in_memory" will store the cache +in the current R session} } \description{ Enable and disable memoisation of gemma.R functions } -\keyword{internal} +\keyword{misc}