Check if a onetime call has already been made
Usage
onetime_been_done(
id = deprecate_calling_package(),
path = default_lockfile_dir(),
expiry = NULL
)
Arguments
- id
Unique ID string. If this is unset, the name of the calling package will be used. Since onetime 0.2.0, not setting
id
is deprecated.- path
Directory to store lockfiles. The default uses a unique directory corresponding to the calling package, beneath
rappdirs::user_config_dir()
. Normally you should leave this as the default.- expiry
difftime()
or e.g.lubridate::duration()
object. After this length of time, code will be run again.
Examples
oo <- options(onetime.dir = tempdir(check = TRUE))
id <- sample(10000L, 1)
onetime_been_done(id = id)
#> [1] FALSE
onetime_message("Creating an ID", id = id)
#> Creating an ID
onetime_been_done(id = id)
#> [1] TRUE
onetime_reset(id = id)
options(oo)