Skip to content

Commit

Permalink
only forget when parent key is forgotten
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed Oct 6, 2024
1 parent 88e8d7e commit e4ac906
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Illuminate/Cache/FileStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,13 @@ public function restoreLock($name, $owner)
*/
public function forget($key)
{
if ($this->files->exists($file = $this->path("illuminate:cache:flexible:created:{$key}"))) {
$this->files->delete($file);
}

if ($this->files->exists($file = $this->path($key))) {
return $this->files->delete($file);
return tap($this->files->delete($file), function ($forgotten) use ($key) {
if ($forgotten && $this->files->exists($file = $this->path("illuminate:cache:flexible:created:{$key}"))) {
$this->files->delete($file);
}
});
}

return false;
Expand Down

0 comments on commit e4ac906

Please sign in to comment.