Skip to content

Provide examples of chunk cache invalidation #1872

@torfason

Description

@torfason

I've been trying to get code chunk cache invalidation to work based on a global variable (which will eventually be a string with a digest hash of several my data set. For now, I would be content with the following.

In code chunk 1, I set my_variable:

my_variable <- "a"

Then in code chunk B, I do a plot, that gets cached, unless I change the value of my_variable in code chunk 1:

#| cache: true
#| cache-vars: my_variable
#| cache-globals: my_variable
#| autodep: true

ggplot(...)

I've been trying around various combination of the chunk settings using the new Quarto syntax. But none of the combinations seems to trigger a refresh of the cached chunk.

An immediate solution would be to have an example here, but even better would be if the documentation (for example at https://quarto.org/docs/reference/cells/cells-knitr.html#cache ) could be a bit clearer on how to achieve this.

Metadata

Metadata

Assignees

Labels

documentationDoc improvements & quarto-web

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions