Allen

Allen

这家伙有点懒,还没写个性签名!

  • 财富值20
  • 威望值0
  • 总积分20

个人信息

  • 2021-01-04 已签到
    连续签到1天,获得了5个金钱
  • yii2-redis为什么不支持pipeline?

  • $redis->multi(\Redis::PIPELINE);

  • 回复了 的回答

    common 下的 config 文件夹内 main-local.php 文件内配置全部 redis:

    'redis' => [
        'class' => 'yii\redis\Connection',
        'hostname' => 'localhost',
        'port' => 6379,
        'database' => 0,
        //'password' => '',
    ],
    

    项目内任何 php 文件调用 redis:
    一、存储字符串
    $redis = Yii::$app->redis
    $redis->exists($key); => 是否存在
    $redis->set($data); => 添加数据到redis
    $redis->expire($key, $expire); => 设置生存周期(秒)
    $redis->get($key); => 获取redis数据

    二、获取、存储hash数据
    1、Yii::$app->redis->hget($key, $hashKey); => 获取redis hash数据
    2、Yii::$app->redis->hset($key, $hashKey, $data); => 设置redis hash数据

    不想回复,就不回复,你这样不是在浪费别人的时间吗?

  • 赞了回答

    common 下的 config 文件夹内 main-local.php 文件内配置全部 redis:

    'redis' => [
        'class' => 'yii\redis\Connection',
        'hostname' => 'localhost',
        'port' => 6379,
        'database' => 0,
        //'password' => '',
    ],
    

    项目内任何 php 文件调用 redis:
    一、存储字符串
    $redis = Yii::$app->redis
    $redis->exists($key); => 是否存在
    $redis->set($data); => 添加数据到redis
    $redis->expire($key, $expire); => 设置生存周期(秒)
    $redis->get($key); => 获取redis数据

    二、获取、存储hash数据
    1、Yii::$app->redis->hget($key, $hashKey); => 获取redis hash数据
    2、Yii::$app->redis->hset($key, $hashKey, $data); => 设置redis hash数据

试用期 等级规则
20/50
资料完整度
30/100
用户活跃度
0/100

Ta的关注

0

Ta的粉丝

0

Ta的访客

0