From 4630971e5cf69131fc19d094e5ec634578500377 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 11 Mar 2020 14:05:21 +0800 Subject: [PATCH] cache 30m, refresh token 7d --- function/common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/function/common.php b/function/common.php index 35b7672..813eb83 100644 --- a/function/common.php +++ b/function/common.php @@ -91,7 +91,7 @@ function getcache($str) return $cache->fetch($str); } -function savecache($key, $value, $exp = 3300) +function savecache($key, $value, $exp = 1800) { $cache = null; $cache = new \Doctrine\Common\Cache\FilesystemCache(sys_get_temp_dir(), __DIR__.'/Onedrive/'.$_SERVER['disktag']); @@ -566,7 +566,7 @@ function main($path) error_log('Get access token:'.json_encode($ret, JSON_PRETTY_PRINT)); $_SERVER['access_token'] = $ret['access_token']; savecache('access_token', $_SERVER['access_token'], $ret['expires_in'] - 300); - if (time()>getConfig('token_expires')) setConfig([ 'refresh_token' => $ret['refresh_token'], 'token_expires' => time()+30*24*60*60 ]); + if (time()>getConfig('token_expires')) setConfig([ 'refresh_token' => $ret['refresh_token'], 'token_expires' => time()+7*24*60*60 ]); } $_SERVER['retry'] = 0;