php - 如何在php Redis中对相似的键进行排序
问题描述
我通过在 php.ini 中使用此代码获得类似的密钥。
$cache = new Redis();
$cache->connect($this->host, $this->port);
$allKeys = $cache->keys($key);
这是我的输出
Array
(
[0] => detail_2
[1] => detail_1
[2] => detail_5
[3] => detail_6
)
这里如何对这些键进行排序,我使用 SET 方法进行键存储。
我尝试了这种方法进行排序$cache->sort($key)
,但它对我没有帮助。