Skip to content

Instantly share code, notes, and snippets.

@reinholdsson
Last active January 6, 2023 12:07
Show Gist options
  • Save reinholdsson/5614341 to your computer and use it in GitHub Desktop.
Save reinholdsson/5614341 to your computer and use it in GitHub Desktop.
Shiny + Redis example
library(rredis)
shinyServer(function(input, output) {
output$show <- renderText({
redisConnect()
res <- redisGet(input$key)
redisClose()
return(res)
})
observe({
if (input$save == 0)
return()
isolate({
redisConnect()
redisSet(input$key, input$value)
redisClose()
})
})
})
shinyUI(bootstrapPage(
selectInput("key", "Key:", LETTERS[1:5]),
textInput("value", "Value:"),
actionButton("save", "Save"),
textOutput("show")
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment