Skip to contents

Given the current project, soucoise_status() collects all information about cache (could be project level, file level) and return a tibble with this data.

Usage

sourcoise_status(quiet = TRUE, root = NULL, prune = TRUE, clean = FALSE)

Arguments

quiet

(boolean) (default TRUE) no messages during execution

root

(string) (default NULL) force root to a defined path, advanced and not recommanded use

prune

(boolean) (default TRUE) clean up status to display only on relevant cache. However, does not clean other cache files.

clean

(boolean) (default FALSE) check if some data files have not json referring to them and cleans if any.

Value

tibble of cached files (see details for structure)

Details

sourcoise_status() reflects what is on the disk (and results indeed from a scan of all cached files and their metadatas). So modifying the result of sourcoise_status() can produce complex bugs when it is passed to sourcoise_refresh() or sourcoise_clean().

Data returned is:

  • src: path to the source file (r script)

  • date: last execution date

  • valid: is cache valid ?

  • uid: id of user

  • index: index of cache

  • timing: last execution timing

  • size: size of the R object(s) returned

  • lapse: periodic refresh trigger

  • wd: wd setting for execution of r script

  • args: arguments passed to R script

  • json_file: path to the file keeping cache information

  • qmd_file: list of path to qmd files calling this script (relevant only for quarto projects)

  • src_in: localisaiton of cache option

  • data_file: path to data cached

  • data_date: date and time of last save of data

  • log_file: path to log file, if logging activated

  • root: path to the project root, used as reference for all paths

  • scr_hash: hash of the source file

  • track_hash: hash of the tracked files, if any

  • track: list of files tracked

  • args_hash: hash of arguments

  • data_hash: hash of data cached

See also

Examples

dir <- tempdir()
fs::file_copy(
    fs::path_package("sourcoise", "ipch", "prix_insee.R"),
    dir,
    overwrite = TRUE)
# Force execution (root is set explicitly here, it is normally deduced from project)
data <- sourcoise("prix_insee.R", root = dir, force_exec = TRUE)
# status returns the cache status
sourcoise_status(root = dir)
#> # A tibble: 1 × 22
#>   src      date                valid uid   index timing size  lapse wd    args  
#>   <chr>    <dttm>              <lgl> <chr> <dbl>  <dbl> <chr> <chr> <chr> <list>
#> 1 prix_in… 2025-03-16 08:54:41 TRUE  451f…     1 0.0518 14 kB never file  <NULL>
#> # ℹ 12 more variables: json_file <fs::path>, qmd_file <list>, src_in <chr>,
#> #   data_file <chr>, data_date <chr>, file_size <chr>, log_file <chr>,
#> #   root <chr>, src_hash <chr>, track_hash <list>, track <list>,
#> #   data_hash <chr>