omnipath_cache_latest_or_new: The latest or a new version of a cache record

omnipath_cache_latest_or_newR Documentation

The latest or a new version of a cache record

Description

Looks up a record in the cache and returns its latest valid version. If the record doesn't exist or no valid version available, creates a new one.

Usage

omnipath_cache_latest_or_new(
  key = NULL,
  url = NULL,
  post = NULL,
  payload = NULL,
  create = TRUE,
  ...
)

Arguments

key

The key of the cache record

url

URL pointing to the resource

post

HTTP POST parameters as a list

payload

HTTP data payload

create

Logical: whether to create and return a new version. If FALSE only the latest existing valid version is returned, if available.

...

Passed to omnipath_cache_get

Value

A cache version item.

Examples

## Not run: 
# retrieve the latest version of the first cache record
# found by the search keyword "bioplex"
latest_bioplex <-
    omnipath_cache_latest_or_new(
        names(omnipath_cache_search('bioplex'))[1]
    )

latest_bioplex$dl_finished
# [1] "2021-03-09 14:28:50 CET"
latest_bioplex$path
# [1] "/home/denes/.cache/OmnipathR/378e0def2ac97985f629-1.rds"

## End(Not run)

# create an example cache record
bioc_url <- 'https://bioconductor.org/'
version <- omnipath_cache_latest_or_new(url = bioc_url)
omnipath_cache_remove(url = bioc_url) # cleaning up


saezlab/OmnipathR documentation built on Oct. 16, 2024, 11:49 a.m.