log = Logger::getLogger(__CLASS__); Logger::configure('./js/log4php/log4php.xml'); if(class_exists("Predis\Client")){ try { //todo changed timeout from 0 to -1 $this->cache = new Predis\Client(array("scheme" => "tcp","host" => "beta.stats.openaire.eu","port" => "6379","read_write_timeout" => -1)); // $this->log->info("redis host: ".$redis_host." and redis port: ".$redis_port); } catch(Exception $e) { $this->log->error("Error connecting to Redis server: ".$e->getMessage()); $this->cache = null; } } else{ $this->log->info("cache does not exist"); //predis exit; } } function test() { if($this->cache != null){ $keys = $this->cache->keys("*"); echo(" ******************TEST CACHE*************************"); //TODO REFRESH CHARTS AND DATA $pertrue=0; $perfalse=0; $per1=0; $datas=0; echo(count($keys)); for($x=0;$xcache->hget($keys[$x],'query'); if($query!=null) { if($this->cache->hget($keys[$x],'persistent')=='true') { $pertrue++; } if($this->cache->hget($keys[$x],'persistent')=='false') {$perfalse++; $this->cache->del($keys[$x]); } if($this->cache->hget($keys[$x],'persistent')=='1') { $per1++; $this->cache->del($keys[$x]); } if(strpos($query,'acronym')===true) { $this->cache->del($keys[$x]); } } else { $this->cache->del($keys[$x]); } //echo("true: ".$pertrue." false : ".$perfalse." one ".$per1."\n\n"); } } } echo("true: ".$pertrue." false : ".$perfalse." one ".$per1."datas".$datas."\n\n"); } } $rc = new TestClean(); $rc->test(); ?>