| .addTagsRepo | R Documentation |
This hidden function appends a single tag (key-value pair) to the metadata
of a cached object identified by its cacheId. Tags can be stored either in
a database (via DBI) or in a file-based cache system.
Updates the value of an existing tag for a cached object identified by its
cacheId. If the tag does not exist and add = TRUE, the tag will be added.
This function supports both database-backed and file-based cache systems.
.addTagsRepo(
cacheId,
cachePath = getOption("reproducible.cachePath"),
tagKey = character(),
tagValue = character(),
cacheSaveFormat = getOption("reproducible.cacheSaveFormat"),
drv = getDrv(getOption("reproducible.drv", NULL)),
conn = getOption("reproducible.conn", NULL),
verbose = getOption("reproducible.verbose")
)
.updateTagsRepo(
cacheId,
cachePath = getOption("reproducible.cachePath"),
tagKey = character(),
tagValue = character(),
add = TRUE,
cacheSaveFormat = getOption("reproducible.cacheSaveFormat"),
drv = getDrv(getOption("reproducible.drv", NULL)),
conn = getOption("reproducible.conn", NULL),
verbose = getOption("reproducible.verbose")
)
cacheId |
|
cachePath |
|
tagKey |
|
tagValue |
|
cacheSaveFormat |
|
drv |
A DBI driver object. Defaults to |
conn |
A DBI connection object. If |
verbose |
|
add |
|
This function is primarily used internally by the reproducible package to
maintain metadata about cached objects. It supports both database-backed and
file-based caching systems.
If useDBI() returns TRUE, the tag update is performed in the database table.
If no rows are affected and add = TRUE, the tag is inserted using .addTagsRepo().
For file-based caches, the function modifies the tag in the corresponding metadata file.
NULL (invisibly). The function is called for its side effects.
NULL (invisibly). Called for its side effects.
.addTagsRepo() for adding tags without updating.
a <- Cache(rnorm(1))
.addTagsRepo(cacheId = gsub("cacheId:", "", attr(a, "tags")),
tagKey = "status", tagValue = "processed")
showCache() # last entry is the above line
a <- Cache(rnorm(1))
# Update an existing tag
.updateTagsRepo(cacheId = gsub("cacheId:", "", attr(a, "tags")),
tagKey = "status", tagValue = "second")
# Add a tag if it doesn't exist
.updateTagsRepo(cacheId = gsub("cacheId:", "", attr(a, "tags")),
tagKey = "status", tagValue = "new", add = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.