Skip to content

Redis cache tags flush cause Error while writing bytes to the server #57545

@MoishyTlushTakin

Description

@MoishyTlushTakin

Laravel Version

12.35

PHP Version

8.3.6

Database Driver & Version

Valkey 8.1

Description

When Trying to flush cache()->tags($tags)->flush(); when there very much keys under this tags, it fails to write the LUA scipt to the server becaude of buffer size, when using Predis in the Predis\Connection\StreamConnection:295 in the write function when perform fwrite($socket, $buffer) it return 0, I think the anser it to chunk the LUA script to chunks let's say 1000 keys in chunk

Steps To Reproduce

in laravel project run the code
function test_tags_flush(array $tags){
foreach (range(1,5000) as $key => $value) {
cache()->tags($tags)->put("key:{$key}", "value:{$value}", 300);
}
cache()->tags($tags)->flush();
}

test_tags_flush(['test-tags-flush']);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions