Esempio n. 1
0
 public function deljcache()
 {
     $rep = $this->getResponse();
     $redisPlugin = jCache::getDriver($this->param('profile'));
     if (get_class($redisPlugin) != 'redisCacheDriver') {
         $rep->addContent("Error, wrong profile. Not a redis cache.\n");
         $this->setExitCode(1);
         return $rep;
     }
     $rep->addContent("--- Starting worker...\n");
     $redis = $redisPlugin->getRedis();
     while (true) {
         $prefixKey = $redis->lpop('jcacheredisdelkeys');
         if (!$prefixKey) {
             sleep(1);
             continue;
         }
         $rep->addContent("flush {$prefixKey}\n");
         $redis->flushByPrefix($prefixKey);
     }
     return $rep;
 }