tagGenerator = $tagGenerator; } public function get(MediaPath $path, string $size, ?string $sizes, array $options = []): string { return Cache::tags($this->pathTag($path))->rememberForever( $this->cacheKey($path, $size), fn () => $this->tagGenerator->generate($path, $size, $sizes, $options) ); } public function delete(MediaPath $path): void { Cache::tags($this->pathTag($path))->flush(); } public function flush(): void { Cache::tags([$this->tagAll])->flush(); } private function cacheKey(MediaPath $path, string $size): string { return "resizer.{$size}.{$path->normal()}"; } private function pathTag(MediaPath $path): array { return [$this->tagAll, $this->singlePathTag($path)]; } public function singlePathTag(MediaPath $path): string { return "resizer.{$path->normal()}"; } public function biggestVersion(string $path, string $size): string { $path = new StorageMediaPath($path); return $this->tagGenerator->singleFile($path, $size); } }