Cache 'CRAN'-Like Metadata and R Packages

Metadata and package cache for CRAN-like repositories. This is a utility package to be used by package management tools that want to take advantage of caching.


files

lifecycle CRANstatus Travis buildstatus AppVeyor buildstatus Coveragestatus

Metadata and package cache for CRAN-like repositories. This is a utility package to be used by package management tools that want to take advantage of caching.

Installation

You can install the released version of pkgcache from CRAN with:

install.packages("pkgcache")

Metadata cache

meta_cache_list() lists all packages in the metadata cache. It includes Bioconductor package, and all versions (i.e. both binary and source) of the packages for the current platform and R version.

library(pkgcache)
meta_cache_list()
#> # A tibble: 30,246 x 29
#>    package title version depends suggests built imports archs repodir
#>    <chr>   <chr> <chr>   <chr>   <chr>    <chr> <chr>   <chr> <chr>  
#>  1 A3      "Acc… 1.0.0   R (>= … randomF… R 3.… <NA>    <NA>  bin/ma…
#>  2 abbyyR  Acce… 0.5.4   R (>= … testtha… R 3.… httr, … <NA>  bin/ma…
#>  3 abc.da… Data… 1.0     R (>= … <NA>     R 3.… <NA>    <NA>  bin/ma…
#>  4 ABC.RAP Arra… 0.9.0   R (>= … knitr, … R 3.… graphi… <NA>  bin/ma…
#>  5 abc     Tool… 2.1     R (>= … <NA>     R 3.… <NA>    <NA>  bin/ma…
#>  6 ABCana… Comp… 1.2.1   R (>= … <NA>     R 3.… plotrix <NA>  bin/ma…
#>  7 abcdeF… "ABC… 0.4     Rglpk,… LIM,syb… R 3.… <NA>    <NA>  bin/ma…
#>  8 ABCopt… Impl… 0.15.0  <NA>    testtha… R 3.… Rcpp, … ABCo… bin/ma…
#>  9 ABCp2   Appr… 1.2     MASS    <NA>     R 3.… <NA>    <NA>  bin/ma…
#> 10 abcrf   Appr… 1.7.1   R(>= 3… <NA>     R 3.… "readr… abcr… bin/ma…
#> # ... with 30,236 more rows, and 20 more variables: platform <chr>,
#> #   rversion <chr>, needscompilation <chr>, ref <chr>, type <chr>,
#> #   direct <lgl>, status <chr>, target <chr>, mirror <chr>,
#> #   sources <list>, deps <list>, license <chr>, linkingto <chr>,
#> #   enhances <chr>, license_restricts_use <chr>, os_type <chr>,
#> #   priority <chr>, license_is_foss <chr>, md5sum <chr>, path <chr>

meta_cache_deps() and meta_cache_revdeps() can be used to look up dependencies and reverse dependencies.

The metadata is updated automatically if it is older than seven days, and it can also be updated manually with meta_cache_update().

See the cranlike_metadata_cache R6 class for a lower level API, and more control.

Package cache

Package management tools may use the pkg_cache_* functions and in particular the package_cache class, to make use of local caching of package files.

The pkg_cache_* API is high level, and uses a user level cache:

pkg_cache_summary()
#> $cachepath
#> [1] "/Users/gaborcsardi/Library/Caches/R-pkg"
#> 
#> $files
#> [1] 40
#> 
#> $size
#> [1] 46040994
pkg_cache_list()
#> # A tibble: 40 x 8
#>    fullpath     path     package  url       etag   md5    version platform
#>    <chr>        <chr>    <chr>    <chr>     <chr>  <chr>  <chr>   <chr>   
#>  1 /Users/gabo… bin/mac… pkgconf… https://… "\"44… 32266… 2.0.2   macos   
#>  2 /Users/gabo… src/con… pkgconf… https://… "\"17… 65742… 2.0.2   source  
#>  3 /Users/gabo… bin/mac… bindr    https://… "\"3b… e7704… 0.1.1   macos   
#>  4 /Users/gabo… bin/mac… assertt… https://… "\"cc… d8cc7… 0.2.0   macos   
#>  5 /Users/gabo… bin/mac… bindrcpp https://… "\"5c… 0a457… 0.2.2   macos   
#>  6 /Users/gabo… bin/mac… cli      https://… "\"4d… 8591a… 1.0.0   macos   
#>  7 /Users/gabo… bin/mac… crayon   https://… "\"b7… aea16… 1.3.4   macos   
#>  8 /Users/gabo… bin/mac… pillar   https://… "\"24… 90119… 1.3.0   macos   
#>  9 /Users/gabo… bin/mac… glue     https://… "\"16… ba05c… 1.3.0   macos   
#> 10 /Users/gabo… bin/mac… magrittr https://… "\"25… 97f02… 1.5     macos   
#> # ... with 30 more rows
pkg_cache_find(package = "dplyr")
#> # A tibble: 2 x 8
#>   fullpath      path     package url        etag   md5    version platform
#> * <chr>         <chr>    <chr>   <chr>      <chr>  <chr>  <chr>   <chr>   
#> 1 /Users/gabor… bin/mac… dplyr   https://c… "\"56… 004df… 0.7.6   macos   
#> 2 /Users/gabor… src/con… dplyr   https://c… "\"ad… cc51d… 0.7.6   source

pkg_cache_add_file() can be used to add a file, pkg_cache_delete_files() to remove files, pkg_cache_get_files() to copy files out of the cache.

The package_cache class provides a finer API.

Code of Conduct

Please note that the ‘pkgcache’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

MIT © RStudio Inc

News

pkgcache 1.0.3

  • Fix concurrency issues when the async API is used multiple times in the same event loop.

  • Make package compatible with tibble >= 2.0.0.

  • Add meta_cache_summary() and a summary() method for cranlike_metadata_cache. Return information about a metadata cache instance.

pkgcache 1.0.2

  • First public release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("pkgcache")

1.0.3 by Gábor Csárdi, 3 months ago


https://github.com/r-lib/pkgcache#readme


Report a bug at https://github.com/r-lib/pkgcache/issues


Browse source code at https://github.com/cran/pkgcache


Authors: Gábor Csárdi [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports assertthat, cli, cliapp, curl, crayon, digest, filelock, glue, prettyunits, R6, rappdirs, rematch2, rlang, tibble, tools, utils, uuid, withr

Suggests callr, covr, debugme, desc, fs, jsonlite, mockery, pingr, rprojroot, testthat


Imported by pak.


See at CRAN