I get similar keys by using this code in php.
$cache = new Redis();
$cache->connect($this->host, $this->port);
$allKeys = $cache->keys($key);
This is my output
Array
(
[0] => detail_2
[1] => detail_1
[2] => detail_5
[3] => detail_6
)
Here how to sort those keys, I'm using the SET method for key storage.
I tried this method for sorting $cache->sort($key), but it didn't help me.