Laravel redis 正则匹配keys 
                                                    
                        
                    
                    
  
                    
                    有时候redis 需要正则匹配到相应的keys, 然后获取keys列表
通用使用command 命令执行keys命令匹配到相应的key
$redis = \Illuminate\Support\Facades\Redis::connection('default');
$result =  $redis->command('KEYS', ['Test:hello:*']);
dd($result);
运行结果
array:8 [
  0 => "Test:hello:1"
  1 => "Test:hello:2"
  2 => "Test:hello:3"
  3 => "Test:hello:4"
  4 => "Test:hello:5"
  5 => "Test:hello:6"
  6 => "Test:hello:7"
  7 => "Test:hello:8"
]
                        
                        本作品采用《CC 协议》,转载必须注明作者和本文链接
          
                    
                    
          
          
                关于 LearnKu
              
                    
                    
                    
 
推荐文章: