bindCache(): web API

  1. Cache effectively only lasts for a single day.
server <- function(input, output, session) {
  events <- reactive({
    req(input$username)
    latest_events(input$username)
  }) %>%
  bindCache(input$username, Sys.Date())
  
  output$events <- renderTable(events())
}

The cache has a fixed total size so it won’t accumulate data from previous days, and is smart enough to automatically remove the least recently used data when it needs more space.