Cache

ir caches package choices, downloads, and R libraries for runs, renders, and package tools.

Set IR_CACHE_DIR to choose where IR keeps its cache. Downloads go in IR_CACHE_DIR/downloads; set RENV_PATHS_SOURCE to put them elsewhere. IR uses renv’s cache for installed packages. Tools installed with ir tool install keep their libraries under IR_TOOL_STORE_DIR, so they survive ir cache clean.

When the package requirements, snapshot date, binary preference, and R installation match an earlier run, IR can reuse the cached library without asking pak to choose packages again. R settings such as R_ARCH and R_HOME also affect reuse.

For packages from online sources, cached choices expire after 24 hours by default. This also applies to snapshot repositories, GitHub, GitLab, Bitbucket, git, URL requests, and remote dependencies of local packages. Different exclude-newer dates have separate cached choices. Set IR_LATEST_RESOLUTION_MAX_AGE_SECONDS=0 to check these choices again on every run.

IR always checks local-only requests and requests with pak query modifiers again. For requests that mix local and remote packages, use --refresh to pick up local edits immediately.

Python environments have a separate cache. If a cached Python executable no longer exists, IR prepares the environment again.

IR keeps separate cached package choices for the default binary preference and for IR_PREFER_BINARIES=0. Leaving the variable unset is the same as setting it to 1.

After upgrading to this release, IR chooses packages again to apply the new default. Existing download and package caches are not deleted.

IR reuses a library only when its package versions and download files match what the run needs. Source builds and pre-built binaries of the same version are kept separate. A library from an unfinished installation is not reused. When an explicit source request is resolved again, renv can reuse the installed package if the source is unchanged.

Use --refresh to ask IR to choose R and Python packages again for one invocation:

$ ir run --refresh --with github::r-xla/anvl -e '.libPaths()'
$ ir render --refresh report.qmd
$ rx --refresh btw --help

--refresh is available on ir run, ir render, ir preview, ir tool run, rx, and ir tool install. Set the nonempty environment variable IR_REFRESH for the same behavior. A refresh keeps downloads, installed packages, and existing environments available for reuse. If the refresh fails, the previous cached result is kept.

Commands

$ ir cache dir
$ ir cache clean
$ ir cache clean --force

ir cache dir prints the cache root. ir cache clean removes IR’s cache directory, including saved package choices, downloads, resolver tooling, cached R libraries, and records for Python environments. It does not remove installed tool libraries under IR_TOOL_STORE_DIR. --force is accepted and has the same behavior.