Skip to contents

According to the parameters, it can remove contents older than a certain age, or contents having a more recent version, one specific item, or wipe the entire cache.

Usage

omnipath_cache_remove(key = NULL, url = NULL, post = NULL,
    payload = NULL, max_age = NULL, min_age = NULL, status = NULL,
    only_latest = FALSE, wipe = FALSE, autoclean = 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

max_age

Age of cache items in days. Remove everything that is older than this age

min_age

Age of cache items in days. Remove everything more recent than this age

status

Remove items having any of the states listed here

only_latest

Keep only the latest version

wipe

Logical: if TRUE, removes all files from the cache and the cache database. Same as calling omnipath_cache_wipe.

autoclean

Remove the entries about failed downloads, the files in the cache directory which are missing from the cache database, and the entries without existing files in the cache directory

Value

Invisibly returns the cache database (list of cache records).

Examples

if (FALSE) {
# remove all cache data from the BioPlex database
cache_records <- omnipath_cache_search(
    'bioplex',
    ignore.case = TRUE
)
omnipath_cache_remove(names(cache_records))

# remove a record by its URL
regnetwork_url <- 'http://www.regnetworkweb.org/download/human.zip'
omnipath_cache_remove(url = regnetwork_url)

# remove all records older than 30 days
omnipath_cache_remove(max_age = 30)

# for each record, remove all versions except the latest
omnipath_cache_remove(only_latest = TRUE)
}

bioc_url <- 'https://bioconductor.org/'
version <- omnipath_cache_latest_or_new(url = bioc_url)
httr::GET(bioc_url, httr::write_disk(version$path, overwrite = TRUE))
#> Response [https://bioconductor.org/]
#>   Date: 2024-04-07 15:20
#>   Status: 200
#>   Content-Type: text/html
#>   Size: 37.3 kB
#> <ON DISK>  /home/denes/.cache/OmnipathR/41346a00fb20d2a9df03aa70cf4d50bf88ab154a-1
omnipath_cache_download_ready(version)
key <- omnipath_cache_key(bioc_url)
omnipath_cache_remove(key = key)