Enforce uniqueness

This commit is contained in:
Lewis Dale 2023-08-27 22:03:56 +01:00
parent e2cf30a307
commit a0580ad085

View File

@ -24,6 +24,9 @@ class SqliteImageDb implements ImageDb {
quality INTEGER NULLABLE, quality INTEGER NULLABLE,
content TEXT NOT NULL content TEXT NOT NULL
)'); )');
// Create a unique index on the path and params
$this->db->exec('CREATE UNIQUE INDEX IF NOT EXISTS images_path_width_height_quality ON images (path, width, height, quality)');
} }
public function findImage(string $path, ResizeParams $params): Image | null { public function findImage(string $path, ResizeParams $params): Image | null {