[PHP] laravel 框架多项目公用redis会有默认前缀 项目名_database_key
2023-02-18 15:36:28 时间
公司多个项目公用一个redis
我这边死活获取不到数据
$selfInfo = Redis::connection('ucs')->hget( 'EMPL_BASEINFO', "5580120537497600" ); var_dump($selfInfo);
使用tcpdump查看端口的数据,才发现laravel默认给key增加了前缀
EMPL_BASEINFO是我要查的key
tcpdump -i any dst port 6379 -l -s 0 -w -|strings|grep EMPL_BASEINFO
会发现多了个 项目名_database_
需要在配置文件里置为空
condig/database.php redis
'ucs' => [ 'host' => env('REDIS_HOST', '192.168.11.12'), 'password' => env('REDIS_PASSWORD', 'ea4725567119b258'), 'port' => env('REDIS_PORT', '6379'), 'database' => 15, 'options' => [ 'prefix' => '', ], ],
相关文章
- 安卓项目五子棋代码详解(三)
- 安卓项目五子棋代码详解(二)
- 安卓项目五子棋代码详解(一)
- 3xx HTTP状态码的终极指南
- React报错之React.Children.only expected to receive single React element child
- React报错之Element type is invalid
- React报错之Too many re-renders
- React报错之Function components cannot have string refs
- 如何发布一个 TypeScript 编写的 npm 包
- 如何使用zx编写shell脚本
- 13个构建RESTful API的最佳实践
- 什么是REST API
- React报错之Rendered more hooks than during the previous render
- 如何使用CSS伪类选择器
- React报错之Property 'value' does not exist on type EventTarget
- React报错之Parameter 'event' implicitly has an 'any' type
- React报错之Parameter 'props' implicitly has an 'any' type
- React报错之Property 'value' does not exist on type 'HTMLElement'
- React报错之You provided a `checked` prop to a form field
- React报错之Invalid hook call