In Redis, I have keys in the following format :
25-1521624987
25-1521624000
25-1521624900
30-1521624900
30-1521624000
35-1521624100
I have written the following code to extract the Redis records with keys that begin with number 25.
$tokens = $rdb->keys("^25-*");
print_r($tokens);
But the result I get with the above code is an empty array.
Although the regex works in Redis Desktop Manager.
What is the correct way to get the required result in PHP redis?
From the documentation (https://github.com/phpredis/phpredis#keys-getkeys)...
$allKeys = $redis->keys('*'); // all keys will match this.
$keyWithUserPrefix = $redis->keys('user*');
So with this I would have to assume it is NOT using regex expressions and you should use...
$tokens = $rdb->keys("25-*");
print_r($tokens);