/**
  * Synchronizacja cache z plikiem
  *
  * @return boolean
  */
 function synchronize()
 {
     try {
         $tCounter = 0;
         if ($this->changed) {
             $tFile = fopen($this->fileName, 'a');
             /*
              * Załóż blokadę na plik cache
              */
             while (!flock($tFile, LOCK_EX)) {
                 usleep(5);
                 $tCounter++;
                 if ($tCounter == 100) {
                     return false;
                 }
             }
             /*
              * Jeśli udało się założyć blokadę, zapisz elementy
              */
             $tContent = serialize($this->elements);
             ftruncate($tFile, 0);
             if ($this->useZip) {
                 $tContent = gzcompress($tContent);
             }
             fputs($tFile, $tContent);
             flock($tFile, LOCK_UN);
             fclose($tFile);
             return true;
         }
     } catch (Exception $e) {
         psDebug::cThrow(null, $e, array('display' => false, 'send' => true));
         return false;
     }
     return true;
 }