Ejemplo n.º 1
0
 public function upToDate($pageSize)
 {
     $this->lazyLoad();
     return $this->item->getSrcModTime() === File::modTime($this->fileName) && $pageSize === $this->item->getPageSize();
 }
Ejemplo n.º 2
0
 private function createCache()
 {
     $lineNumber = 1;
     $pos = [0];
     $handler = $this->handler->getFileHandler();
     while (fgets($handler, 8196) !== false) {
         if ($lineNumber % $this->pageSize === 0) {
             $pos[] = ftell($handler);
         }
         $lineNumber++;
     }
     if (count($pos) === 1) {
         $this->pageSize = $lineNumber - 1;
     }
     array_push($pos, File::size($this->getFileName()));
     $item = new CacheItem($pos, File::modTime($this->getFileName()), $this->pageSize);
     $this->cache->create($item);
 }