fixes needed

This commit is contained in:
Grzegorz Surmann 2024-09-03 00:01:39 +02:00
parent 673c022e71
commit 3036974d3e

View File

@ -2,6 +2,8 @@
class PHPCACHER { class PHPCACHER {
static function isCached($item) { static function isCached($item) {
global $phpcacher_ttl;
global $phpcacher_path;
if ( !isset($phpcacher_ttl) ) { $phpcacher_ttl=3600; }; if ( !isset($phpcacher_ttl) ) { $phpcacher_ttl=3600; };
if ( !isset($phpcacher_path) ) { $phpcacher_path="./cache"; }; if ( !isset($phpcacher_path) ) { $phpcacher_path="./cache"; };
$file=$phpcacher_path."/".md5($item).".data"; $file=$phpcacher_path."/".md5($item).".data";
@ -10,6 +12,8 @@ class PHPCACHER {
} }
} }
static function isValid($item) { static function isValid($item) {
global $phpcacher_ttl;
global $phpcacher_path;
if ( !isset($phpcacher_ttl) ) { $phpcacher_ttl=3600; }; if ( !isset($phpcacher_ttl) ) { $phpcacher_ttl=3600; };
if ( !isset($phpcacher_path) ) { $phpcacher_path="./cache"; }; if ( !isset($phpcacher_path) ) { $phpcacher_path="./cache"; };
$file=$phpcacher_path."/".md5($item).".data"; $file=$phpcacher_path."/".md5($item).".data";
@ -18,6 +22,7 @@ class PHPCACHER {
} }
} }
static function put($item,$data) { static function put($item,$data) {
global $phpcacher_path;
if ( !isset($phpcacher_path) ) { $phpcacher_path="./cache"; }; if ( !isset($phpcacher_path) ) { $phpcacher_path="./cache"; };
@mkdir($phpcacher_path,0755,TRUE); @mkdir($phpcacher_path,0755,TRUE);
$file=$phpcacher_path."/".md5($item).".data"; $file=$phpcacher_path."/".md5($item).".data";
@ -25,6 +30,8 @@ class PHPCACHER {
return TRUE; return TRUE;
} }
static function get($item) { static function get($item) {
global $phpcacher_ttl;
global $phpcacher_path;
if ( !isset($phpcacher_ttl) ) { $phpcacher_ttl=3600; }; if ( !isset($phpcacher_ttl) ) { $phpcacher_ttl=3600; };
if ( !isset($phpcacher_path) ) { $phpcacher_path="./cache"; }; if ( !isset($phpcacher_path) ) { $phpcacher_path="./cache"; };
$file=$phpcacher_path."/".md5($item).".data"; $file=$phpcacher_path."/".md5($item).".data";
@ -36,6 +43,7 @@ class PHPCACHER {
return FALSE; return FALSE;
} }
static function del($item) { static function del($item) {
global $phpcacher_path;
if ( !isset($phpcacher_path) ) { $phpcacher_path="./cache"; }; if ( !isset($phpcacher_path) ) { $phpcacher_path="./cache"; };
$file=$phpcacher_path."/".md5($item).".data"; $file=$phpcacher_path."/".md5($item).".data";
if ( self::isCached($item) ) { if ( self::isCached($item) ) {