Aliases: brewCache setBufLen brewCacheOn brewCacheOff
Keywords: utilities
### ** Examples ## Turn on caching brewCacheOn() ## Brew a template brew(system.file("featurefull.brew",package="brew"),envir=new.env())
You won't see this R output, but it will run. Now foo is bar and today is August 11, 2025. How about generating a template from a template? <% foo <- 'fee fi fo fum' brew <- 'haha' %> foo is still bar. Contents of current directory: character(0)
## Get the internal cache cache <- brewCache() ## Inspect as.list(cache)
$`/data/rcloud/library/4.2/brew/featurefull.brew` $`/data/rcloud/library/4.2/brew/featurefull.brew`$mtime [1] "2024-11-28 08:46:27 UTC" $`/data/rcloud/library/4.2/brew/featurefull.brew`$env <environment: 0x55ccfff3fdc0>
## Inspect first file cached in list as.list(cache)[[1]]
$mtime [1] "2024-11-28 08:46:27 UTC" $env <environment: 0x55ccfff3fdc0>
## Inspect environment that contains text and parsed code as.list(as.list(cache)[[1]]$env)
$code expression(.brew.cat(1, 1), foo <- "bar", .brew.cat(3, 4), cat(foo), .brew.cat(6, 6), cat(format(Sys.time(), "%B %d, %Y")), .brew.cat(8, 8), .brew.cat(13, 20), cat(foo), .brew.cat(22, 23), print(dir()), .brew.cat(25, 25)) $text [1] "You won't see this R output, but it will run. " [2] " foo <- 'bar' " [3] "\n" [4] "Now foo is " [5] "foo" [6] " and today is " [7] "format(Sys.time(),'%B %d, %Y')" [8] ".\n" [9] "# Comment -- ignored -- useful in testing. \n" [10] " Also notice the dash-percent-gt.\n" [11] " It chops off the trailing newline. \n" [12] " You can add it to any percent-gt. " [13] "How about generating a template from a template?\n" [14] "<%" [15] " \n" [16] "\tfoo <- 'fee fi fo fum' \n" [17] "\tbrew <- 'haha'\n" [18] "%>" [19] "\n" [20] "foo is still " [21] "foo" [22] ".\n" [23] "Contents of current directory:\n" [24] " print(dir()) " [25] "\n"
## Turn off brew caching brewCacheOff() rm(cache)