1

Running my application inside a redis cluster and I stumbled about a strange issue:

dd(Redis::connection('default')->scan('0', [
    'match' => 'my_application_cache_*',
    'count' => 999,
]));

returns:

array:2 [▼ // app/Http/Controllers/User/ProfileController.php:30
  0 => 1
  1 => []
]

Running the same command with redis-cli like:

127.0.0.1:6379> scan 0 MATCH my_application_cache_* COUNT 9999

returns:

1) "0"
2)  1) "my_application_cache_:SLY6WWj9cymyZzJk0BihOYAm7uNQT9T55bYrvGMB"
    2) "my_application_cache_:IDF8Qe713Y06XOEmaQC7mzyupKgURusIaTxLt1Nx"
    3) "my_application_cache_:4JRZ1Zd8hg2FwQzO5JTRlWuyxIi07V0ERqXtAVer"
    4) "my_application_cache_:GWv8tisv4xQAgBaXdJap62aJh95V5mWvTiw9CQ0X"
    5) "my_application_cache_:hTKTDsUN9YsuuHlxJdFSflL737MvvPZPX0O9uNLQ"

Any idea why laravel isn't returning any values inside the 1 element of the array?

1
  • Have you done a subsequent scan using 1 as the cursor? That's what redis is telling you to do I think. Check the docs for scan maybe your issue has to do with the fact that it filters out entries that don't match your glob after fetching results, so you can end up with empty result sets for a given cursor. Just a guess though Commented Feb 2, 2023 at 6:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.