@@ -51,7 +51,7 @@ public function get_system_config_with_meta($userid, $systemid)
5151 );
5252 }
5353
54- if ($ result = $ this ->redis ->get ("appconfig: $ systemid " )) {
54+ if ($ this -> redis && $ result = $ this ->redis ->get ("appconfig: $ systemid " )) {
5555 $ config = json_decode ($ result );
5656 $ config ->config_cache = true ;
5757 return $ config ;
@@ -64,8 +64,10 @@ public function get_system_config_with_meta($userid, $systemid)
6464 $ config ->apikey = $ result ['readkey ' ];
6565 if ($ config ->apikey =="" ) $ config ->apikey = false ;
6666
67- $ this ->redis ->set ("appconfig: $ systemid " ,json_encode ($ config ));
68- $ this ->redis ->expire ("appconfig: $ systemid " ,10 );
67+ if ($ this ->redis ) {
68+ $ this ->redis ->set ("appconfig: $ systemid " ,json_encode ($ config ));
69+ $ this ->redis ->expire ("appconfig: $ systemid " ,10 );
70+ }
6971 return $ config ;
7072 }
7173 return $ result ;
@@ -261,7 +263,7 @@ public function get($table_name, $start=false, $end=false, $system_id = false, $
261263 // Generate cache key for public mode
262264 if ($ mode === "public " && $ start === false && $ end === false && $ system_id === false ) {
263265 // Try to get from cache first
264- if ($ cached_result = $ this ->redis ->get ($ table_name ."_public_cache " )) {
266+ if ($ this -> redis && ( $ cached_result = $ this ->redis ->get ($ table_name ."_public_cache " ) )) {
265267 // return json_decode($cached_result, true);
266268 }
267269 }
@@ -362,7 +364,7 @@ public function get($table_name, $start=false, $end=false, $system_id = false, $
362364 }
363365
364366 // Cache the result if mode is public
365- if ($ mode === "public " && $ start === false && $ end === false && $ system_id === false && $ stats !== false ) {
367+ if ($ this -> redis && $ mode === "public " && $ start === false && $ end === false && $ system_id === false && $ stats !== false ) {
366368 //$this->redis->set($table_name."_public_cache", json_encode($stats));
367369 //$this->redis->expire($table_name."_public_cache", 3600); // 1 hour = 3600 seconds
368370 }
0 commit comments