Skip to content

Cache::forget() doesn't delete cache created via Cache::flexible() #52847

@Tklaversma

Description

@Tklaversma

Laravel Version

11.23

PHP Version

8.3

Database Driver & Version

No response

Description

I potentially found a bug with Cache::flexible(). Not sure if it is intended or not... but I guess not.

When using Cache::flexible(), two items are stored in the cache. Whenever I Cache::forget() an item that was created via flexible, it doesn't delete the second item (...:created). Now I have to manually delete that item, so the cache is actually gone.

Steps To Reproduce

Step 1:

Cache::flexible('foo', [1, 100], function () {
    return 'bar';
});

Two items are cached:

  1. "example"
  2. "example:created"

Step 2:

Cache::forget('foo');

One item is deleted, example.
The other example:created still exists.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions