diff options
Diffstat (limited to 'include/functions.php')
-rw-r--r-- | include/functions.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/functions.php b/include/functions.php index f8a0da4..8307648 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1071,6 +1071,30 @@ function format_score_table_html($score,$userid) return $output; } +function createCache($content, $cacheFile) +{ + $fp = fopen($cacheFile,"w"); + if($fp) + { + fwrite($fp,$content); + fclose($fp); + } + else + echo "WARNING: couldn't create cache file"; + + return; +} + +function getCache($cacheFile, $expireTime) +{ + if( file_exists($cacheFile) && + filemtime($cacheFile )>( time() - $expireTime ) ) + { + return file_get_contents($cacheFile); + } + + return false; +} ?> |