R Shiny app shows old data

后端 未结 3 1423
无人及你
无人及你 2021-01-12 08:16

I have shiny app, which is displaying old data (4 days delay!) though on the server data are refreshed (current day).

What is strange the old dataset does not exist

3条回答
  •  礼貌的吻别
    2021-01-12 08:42

    I found that cache of R Shiny server is updated when the date of creation for the file "app.R" is changed.

    So, here is the trick I used:

    server <- function(input, output, session) {
    
       # Trick file date creation update
       onStop(function() {
    
         # File name
         p <- paste0(getwd(), "/app.R")
    
         # Update file 'date creation'
         Sys.setFileTime(p, now())
    
      }) # onStop
    
     ...
    
    
    } # server
    

    The idea is to update the date of "app.R" creation after each session.

提交回复
热议问题