opencpu创建临时文件的超时时间可以延长吗?

Can the timeout for the temporary file created by opencpu be extended?

我有几个函数可以 return 图形或 table 图像格式。 创建它们后,我使用 link 引用了它们。 问题是有时我将那些 link 发送给第三方,当他们阅读它们时 link 已经过期,因此没有附加 "image"。 是否可以通过任何类型的配置来延长临时文件的有效期?

是的!删除临时文件的清理脚本在 /etc/cron.d/opencpu 中触发。它有一个 shell 脚本,如下所示:

#This removes entries from the "temporary library" over a day old.
if [ -d "/tmp/ocpu-store" ]; then
    find /tmp/ocpu-store/ -mindepth 1 -mmin +1440 -user www-data -delete || true
    find /tmp/ocpu-store/ -mindepth 1 -mmin +1440 -user www-data -type d -empty -exec rmdir {} \; || true
fi

因此您可以将 1440 修改为更高的值,或者将 cron 行更改为 运行 以降低频率。