Update cache.php

This commit is contained in:
FusionPBX
2019-10-15 13:54:55 -06:00
committed by GitHub
parent 00133fb0e3
commit a6eb416982

View File

@@ -40,13 +40,13 @@ class cache {
if ($fp === false) { if ($fp === false) {
return false; return false;
} }
//send a custom event //send a custom event
//run the memcache //run the memcache
$command = "memcache set ".$key." ".$value; $command = "memcache set ".$key." ".$value;
$result = event_socket_request($fp, 'api '.$command); $result = event_socket_request($fp, 'api '.$command);
//close event socket //close event socket
fclose($fp); fclose($fp);
} }
@@ -58,7 +58,7 @@ class cache {
} }
} }
// return result //return result
return $result; return $result;
} }
@@ -75,26 +75,26 @@ class cache {
if ($fp === false) { if ($fp === false) {
return false; return false;
} }
//send a custom event //send a custom event
//run the memcache //run the memcache
$command = "memcache get ".$key; $command = "memcache get ".$key;
$result = event_socket_request($fp, 'api '.$command); $result = event_socket_request($fp, 'api '.$command);
//close event socket //close event socket
fclose($fp); fclose($fp);
} }
//get the file cache //get the file cache
if ($_SESSION['cache']['method']['text'] == "file") { if ($_SESSION['cache']['method']['text'] == "file") {
if (file_exists($_SESSION['cache']['location']['text'] . "/" . $key)) { if (file_exists($_SESSION['cache']['location']['text'] . "/" . $key)) {
$result = file_get_contents($_SESSION['cache']['location']['text'] . "/" . $key); $result = file_get_contents($_SESSION['cache']['location']['text'] . "/" . $key);
} }
} }
// return result //return result
return $result; return $result;
} }
@@ -187,7 +187,6 @@ class cache {
//close event socket //close event socket
fclose($fp); fclose($fp);
} }
//cache method file //cache method file
@@ -202,10 +201,9 @@ class cache {
//remove the cache //remove the cache
recursive_delete($_SESSION['cache']['location']['text']); recursive_delete($_SESSION['cache']['location']['text']);
} }
// return result //return result
return $result; return $result;
} }
} }