tag = $tag; $this->fileObserver = $fileObserver; } public function get(string $path, string $size): string { return Cache::tags($this->getTag($path)) ->rememberForever($this->cacheKey($path, $size), fn () => $this->tag->generate($path, $size)); } public function delete(string $path): void { $path = $this->fileObserver->normalizePath($path); Cache::tags("resizer.$path")->flush(); } private function getTag(string $path): array { return ['resizer', "resizer.{$this->fileObserver->normalizePath($path)}"]; } private function cacheKey(string $path, string $size): string { $normalPath = $this->fileObserver->normalizePath($path); return "resizer.{$size}.{$normalPath}"; } }