Fix app- and session-level cache initialization

This commit is contained in:
Winston Chang
2018-07-19 14:39:08 -05:00
parent 719dbab0c2
commit e58b2e9a47
2 changed files with 2 additions and 14 deletions

View File

@@ -598,12 +598,9 @@ runApp <- function(appDir=getwd(),
)
on.exit(options(ops), add = TRUE)
# Set up default disk cache for app. Default is 5 MB in size.
# Set up default cache for app.
if (is.null(getShinyOption("cache"))) {
cacheDir <- file.path(tempdir(), paste0("shinyapp-", getShinyOption("appToken")))
cache <- MemoryCache$new()
on.exit(cache$destroy(), add = TRUE)
shinyOptions(cache = cache)
shinyOptions(cache = MemoryCache$new())
}
appParts <- as.shiny.appobj(appDir)

View File

@@ -738,16 +738,7 @@ ShinySession <- R6Class(
private$.outputs <- list()
private$.outputOptions <- list()
# Session-level cache
cacheDir <- file.path(
tempdir(),
paste0("shinyapp-", getShinyOption("appToken")),
paste0("session-", self$token)
)
private$cache <- MemoryCache$new()
# Destroy the cache when the session exits. This is more predictable
# than using destroy_on_finalize.
self$onSessionEnded(private$cache$destroy)
private$bookmarkCallbacks <- Callbacks$new()
private$bookmarkedCallbacks <- Callbacks$new()