Are data objects persistent in openCPU's R session?

前端 未结 1 1183
伪装坚强ぢ
伪装坚强ぢ 2021-01-13 16:18

I would like to provide a web tool that requires access to a large dataset. Preferentially, this R data object should be loaded into memory once and then be available for us

相关标签:
1条回答
  • 2021-01-13 16:42

    The OpenCPU API is stateless, there is no way to keep a process alive in between requests. But you can easily solve your problem by putting your dataset into a package, and installing that on the server.

    You can use the preload option described in the server manual, or use the /etc/opencpu/Rprofile script to load the package with the dataset in memory when the server starts. That way the data will be will be ready to use when requests come in.

    0 讨论(0)
提交回复
热议问题