cran_archive_cache | R Documentation |
This is an R6 class that implements a cache from older CRAN package
versions. For a higher level interface see the functions documented
with cran_archive_list()
.
The cache is similar to cranlike_metadata_cache and has the following layers:
The data inside the cran_archive_cache
object.
Cached data in the current R session.
An RDS file in the current session's temporary directory.
An RDS file in the user's cache directory.
It has a synchronous and an asynchronous API.
cac <- cran_archive_cache$new( primary_path = NULL, replica_path = tempfile(), cran_mirror = default_cran_mirror(), update_after = as.difftime(7, units = "days"), ) cac$list(packages = NULL, update_after = NULL) cac$async_list(packages = NULL, update_after = NULL) cac$update() cac$async_update() cac$check_update() cac$async_check_update() cac$summary() cac$cleanup(force = FALSE)
primary_path
: Path of the primary, user level cache. Defaults to
the user level cache directory of the machine.
replica_path
: Path of the replica. Defaults to a temporary directory
within the session temporary directory.
cran_mirror
: CRAN mirror to use, this takes precedence over repos
.
update_after
: difftime
object. Automatically update the cache if
it gets older than this. Set it to Inf
to avoid updates. Defaults
to seven days.
packages
: Packages to query, character vector.
force
: Whether to force cleanup without asking the user.
Create a new archive cache with cran_archive_cache$new()
. Multiple
caches are independent, so e.g. if you update one of them, the other
existing caches are not affected.
cac$list()
lists the versions of the specified packages, or all
packages, if none were specified. cac$async_list()
is the same, but
asynchronous.
cac$update()
updates the cache. It always downloads the new metadata.
cac$async_update()
is the same, but asynchronous.
cac$check_update()
updates the cache if there is a newer version
available. cac$async_check_update()
is the same, but asynchronous.
cac$summary()
returns a summary of the archive cache, a list with
entries:
cachepath
: path to the directory of the main archive cache,
current_rds
: the RDS file that stores the cache. (This file might
not exist, if the cache is not downloaded yet.)
lockfile
: the file used for locking the cache.
'timestamp: time stamp for the last update of the cache.
size
: size of the cache file in bytes.
cac$cleanup()
cleans up the cache files.
cac$list()
returns a data frame with columns:
package
: package name,
version
: package version. This is a character vector, and not
a package_version()
object. Some older package versions are not
supported by package_version()
.
raw
: the raw row names from the CRAN metadata.
mtime
: mtime
column from the CRAN metadata. This is usually
pretty close to the release date and time of the package.
url
: package download URL.
mirror
: CRAN mirror that was used to get this data.
arch <- cran_archive_cache$new()
arch$update()
arch$list()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.