mirror of https://github.com/myphpfw/myphpfw.git
added caching read function
This commit is contained in:
parent
7e33582e4d
commit
d3deaeffdc
7
mpf.php
7
mpf.php
|
@ -63,6 +63,13 @@ ENDHELP;
|
|||
function set_cache(array $modules): void {
|
||||
file_put_contents(".cache", json_encode($modules));
|
||||
}
|
||||
function load_cache(): array|bool {
|
||||
if(!is_file(".cache")) {
|
||||
return FALSE;
|
||||
}
|
||||
$modules = json_decode(file_get_contents(".cache"), TRUE);
|
||||
return $modules;
|
||||
}
|
||||
|
||||
if(sizeof($argv) < 2 || !required_argument($argv[1])) _help($argv[0], "No <command> provided!\n\n"); // check for user input presence
|
||||
switch($argv[1]) { // act according to said input
|
||||
|
|
Loading…
Reference in New Issue