博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
phpredis使用zadd批量添加到集合
阅读量:3985 次
发布时间:2019-05-24

本文共 580 字,大约阅读时间需要 1 分钟。

命令行

ZADD key score member [[score member] [score member] ...]
redis> ZADD page_rank 9 baidu.com 8 bing.com(integer) 2redis> ZRANGE page_rank 0 -1 WITHSCORES1) "bing.com"2) "8"3) "baidu.com"4) "9"5) "google.com"6) "10"

使用phpredis

// call_user_func_array(array($this->redis, 'zadd'), array('key', 0, 'we', 2, 'me', 3, 'td', 8, 'go'));$set = [$cachekey];foreach($data as $member => $score){
array_push($set, $score, $member);}call_user_func_array(array($this->redis, 'zadd'), $set);或者静态调用call_user_func_array([Redis::class, 'zadd'], $set);

//array第一项是这个有序列表的键,后续的项目是排序权重,和值的交替

转载地址:http://kwaui.baihongyu.com/

你可能感兴趣的文章
coursesa课程 Python 3 programming Dictionary methods 字典的方法
查看>>
coursesa课程 Python 3 programming Accumulating Multiple Results In a Dictionary 统计文件的字母数量
查看>>
Returning a value from a function
查看>>
coursesa课程 Python 3 programming Functions can call other functions 函数调用另一个函数
查看>>
coursesa课程 Python 3 programming Tuple Assignment with Unpacking
查看>>
coursesa课程 Python 3 programming The while Statement
查看>>
course_2_assessment_6
查看>>
coursesa课程 Python 3 programming course_2_assessment_7 多参数函数练习题
查看>>
coursesa课程 Python 3 programming 排序函数sorted的可选参数
查看>>
coursesa课程 Python 3 programming course_2_assessment_8 sorted练习题
查看>>
visca接口转RS-232C接口线序
查看>>
在unity中建立最小的shader(Minimal Shader)
查看>>
RGB 立方体
查看>>
1.3 Debugging of Shaders (调试着色器)
查看>>
关于phpcms中模块_tag.class.php中的pc_tag()方法的含义
查看>>
vsftp 配置具有匿名登录也有系统用户登录,系统用户有管理权限,匿名只有下载权限。
查看>>
linux安装usb wifi接收器
查看>>
关于共享单车定位不准问题
查看>>
ubuntu误删文件造成软件包信息列表损坏无法更新或安装文件
查看>>
终于搞定CString和string之间转换的问题了
查看>>