This is still very experimental. See examples.

cloudCache(..., useCloud = getOption("reproducible.useCloud", TRUE),
  checksumsFileID = NULL, cloudFolderID = NULL)

Arguments

...

Passed to Cache

useCloud

Logical. This allows this to be turned off; will send all arguments to Cache (including possibly useCache, where all caching can be turned off)

checksumsFileID

A google file ID where the checksums data.table is located, provided as a character string.

cloudFolderID

The google folder ID where a new checksums file should be written. This will only be used if checksumsFileID is not provided provided as a character string.

Details

This has Cache internally. The main goal of this function is to look at local Cache first, if the object is there locally, then use it & upload it to googledrive. If the object is not there locally, check on googledrive for the object. If it is there, download it, then add it to the local Cache. If it is not there, then run the function de novo, wrapped in Cache and upload the object to googledrive (i.e., it will be in local Cache and cloud location).

Note

This is essentially a wrapper around Cache, so it will still use the local Cache.

See also

Examples

# NOT RUN {
# Make a folder on googledrive -- share it with yourself and anybody else -- either use
#   googledrive package or do this manually on drive.google.com
# Grab the share link -- pass it here to cloudFolderID

# first time -- looks in cloudFolderID for checksums -- none there, so it makes it
#   then it runs the function, caching locally, and uploading to cloud -- copy exists in
#   2 places
library(googledrive)
newDir <- drive_mkdir("testFolder")
a1 <- cloudCache(rnorm, 1, cloudFolderID = newDir$id)
# second time -- sees that it is in both places, takes local
a2 <- cloudCache(rnorm, 1, cloudFolderID = newDir$id)

# clear local -- get from cloud copy, make a local copy in cacheRepo
clearCache(ask = FALSE)
a3 <- cloudCache(rnorm, 1, cloudFolderID = newDir$id)

# now both local and cloud exist
a4 <- cloudCache(rnorm, 1, cloudFolderID = newDir$id)

# Clean up -- see cloudSyncCache
# }