Skip to contents

info lists the System 1 answer cache (held in memory for the R session while there is no .gptr/), the System 2 answer cache used for replay, temporary spill files and unapplied document sidecars (deferred or pending blocks; a second row lists those of documents outside any .gptr/, kept in the user cache; they are never removed here: apply them with gptr_doc(path, sync = TRUE)). prune removes System 2 answers whose block is neither in its document nor queued for it in a sidecar, System 1 answers unused for 90 days, temporary files older than getOption("gptr.spill_days", 7) days and older refreshed model catalogs; clear removes a kind entirely.

Usage

gptr_cache(
  action = c("info", "prune", "clear"),
  kind = c("all", "s1", "s2", "tmp")
)

Arguments

action

"info", "prune" or "clear".

kind

"all", "s1", "s2" or "tmp".

Value

info: a gptr_cache_info data frame with columns kind, entries, bytes, oldest, path ("memory" for System 1 answers held without a .gptr/ workspace). prune and clear: the number of entries removed, invisibly.

Details

Clearing the System 2 answer cache does not remove the R code of document blocks, but saved answers needed to reconstruct a replayed call may no longer be available.

Examples

proj = tempfile("proj")
dir.create(file.path(proj, ".gptr"), recursive = TRUE)
old = options(gptr.project_root = proj)
gptr_cache()
#>   kind     entries  bytes  oldest  path
#> 1 s1       0        0      NA      /tmp/Rtmp753Ve2/rel-site-...
#> 2 s2       0        0      NA      /tmp/Rtmp753Ve2/rel-site-...
#> 3 tmp      0        0      NA      /tmp/Rtmp753Ve2/rel-site-...
#> 4 sidecar  0        0      NA      /tmp/Rtmp753Ve2/rel-site-...
#> 5 sidecar  0        0      NA      /tmp/Rtmp753Ve2/rel-site-...
#> 
#> # 5 rows
gptr_cache("prune", "tmp")
options(old)
unlink(proj, recursive = TRUE)