From e284831eede7e1bd65ab289240ea6fa5cd8c51c2 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Thu, 9 Jan 2020 14:14:19 +0800 Subject: [PATCH] Update functions.php --- functions.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/functions.php b/functions.php index 37e6b14..287bd1d 100644 --- a/functions.php +++ b/functions.php @@ -34,6 +34,20 @@ function getGET() } } +function getcache($str) +{ + $cache = null; + $cache = new \Doctrine\Common\Cache\FilesystemCache(sys_get_temp_dir(), '.Onedrive'); + return $cache->fetch($str); +} + +function savecache($key, $value, $exp = 3300) +{ + $cache = null; + $cache = new \Doctrine\Common\Cache\FilesystemCache(sys_get_temp_dir(), '.Onedrive'); + $cache->save($key, $value, $exp); +} + function config_oauth() { global $constStr; @@ -235,9 +249,7 @@ function get_refresh_token() document.cookie=\'language=; path=/\'; '; setConfig([ 'refresh_token' => $tmptoken ]); - $cache = null; - $cache = new \Doctrine\Common\Cache\FilesystemCache(sys_get_temp_dir(), '.Onedrive'); - $cache->save('access_token', $ret['access_token'], $ret['expires_in'] - 60); + savecache('access_token', $ret['access_token'], $ret['expires_in'] - 60); $str .= ' '; return message($str, $constStr['WaitJumpIndex'][$constStr['language']]);