Skip to content

Only flush cache when delete() returns a count  #435

@m-lotze

Description

@m-lotze

The two methods delete and forceDelete in Buildable trait should imho only flush the cache, if the parent methods return an int > 0. Right now, the cache is flushed every time, even when the query did not actually deleted records from the database.

public function delete()
{
    $result = parent::delete();

    if ($result) {
        $this->cache($this->makeCacheTags())->flush();
    }

    return $result;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions