% Generated by roxygen2: do not edit by hand % Please edit documentation in R/render-plot.R \name{plotCache} \alias{plotCache} \title{Disk-based plot cache} \usage{ plotCache(invalidationExpr, width, height, res = 72, plotFunc, cachePath = NULL, invalidation.env = parent.frame(), invalidation.quoted = FALSE, session = getDefaultReactiveDomain()) } \arguments{ \item{invalidationExpr}{Any expression or block of code that accesses any reactives whose invalidation should cause cache invalidation. This typically would be an expression that indicates that the source data has changed. Use \code{NULL} if you don't want to cause cache invalidation.} \item{width, height}{The dimensions of the plot. (Use double the user width/height for retina/hi-dpi compatibility.)} \item{res}{The resolution of the PNG. Use 72 for normal screens, 144 for retina/hi-dpi.} \item{plotFunc}{Plotting logic, provided as a function that takes zero or more arguments. Don't worry about setting up a graphics device or creating a PNG; just write to the graphics device (you must call \code{print()} on ggplot2 objects).} \item{cachePath}{The location on disk where the cache will be stored. By default, uses a temp directory, which is generally cleaned up during a normal shutdown of the R process.} \item{invalidation.env}{The environment where the \code{invalidationExpr} is evaluated.} \item{invalidation.quoted}{Is \code{invalidationExpr} expression quoted? By default, this is FALSE. This is useful when you want to use an expression that is stored in a variable; to do so, it must be quoted with \code{quote()}.} } \description{ Creates a read-through cache for plots. The plotting logic is provided as plotFunc, a function that can have any number/combination of arguments; the return value of \code{plotCache()} is a function that should be used in the place of plotFunc. Each unique combination of inputs will be cached to disk in the location specified by \code{cachePath}. } \details{ The \code{invalidationExpr} expression will be monitored and whenever it is invalidated, so too is the cache invalidated (the contents are erased). }