This repository has been archived by the owner on May 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathmanage_cached_files.R
53 lines (52 loc) · 1.71 KB
/
manage_cached_files.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#' @title Manage locally cached bomrang files
#'
#' @description Manage cached \CRANpkg{bomrang} satellite imagery files with
#' \CRANpkg{hoardr}.
#'
#' @export
#' @name manage_cache
#'
#' @details The default cache directory is\cr
#' \code{file.path(rappdirs::user_cache_dir(), "R/bomrang")}, but you can
#' set your own path using \code{manage_cache$cache_path_set()}
#'
#' \code{manage_cache$cache_delete} only accepts one file name, while
#' \code{manage_cache$cache_delete_all} does not accept any names, but deletes
#' all files. For deleting many specific files, use\cr
#' \code{manage_cache$cache_delete} in an \code{\link[base]{lapply}} type call.
#'
#' @section Useful user functions:
#' \itemize{
#' \item \code{manage_cache$cache_path_get()} - get cache path
#' \item \code{manage_cache$cache_path_set()} - set cache path
#' \item \code{manage_cache$list()} - returns a character vector of full
#' path file names
#' \item \code{manage_cache$files()} - returns file objects with metadata
#' \item \code{manage_cache$details()} - returns files with details
#' \item \code{manage_cache$delete()} - delete specific files
#' \item \code{manage_cache$delete_all()} - delete all files, returns
#' nothing
#' }
#'
#' @examples \dontrun{
#'
#' # list files in cache
#'
#' imagery <- get_satellite_imagery(product_id = "IDE00425",
#' scans = 1,
#' cache = TRUE)
#'
#' manage_cache$list()
#'
#' # delete certain database files
#' manage_cache$delete("file path")
#' manage_cache$list()
#'
#' # delete all files in cache
#' manage_cache$delete_all()
#' manage_cache$list()
#'
#' # set a different cache path from the default
#' manage_cache$cache_path_set("~/tmp")
#' }
NULL