随笔分类 - redis
摘要:从异步,用延时来处理,改成同步获取数据 获取数据主要分2步: 1.从redis集合中获取数组; 2.遍历数组,抓取其中字符串,解析,拼接成需要的数据,返回给前端 原代码,用sleep方法,避免异步数据处理带来的提前返回数据的问题; (缺点:时间比较久,逻辑中是有问题的) // 获取线路上公交的位置信
阅读全文
摘要:可以使用redis模块来连接和操作Redis数据库。以下是使用该模块获取Redis集合内容的同步方法: // 引入redis模块 const redis = require('redis'); // 创建redis客户端 const client = redis.createClient(); //
阅读全文
摘要:redis-server ../redis.conf 开启服务,进程得守护着,命令终端不能退出 redis-server& ../redis.conf 开启服务,进程不用留在终端打开的效果 解决办法: https://www.cnblogs.com/AllWjw/p/15771097.html
阅读全文
摘要:Redis 的 Set 是 String 类型的无序集合。集合成员是唯一的,这就意味着集合中不能出现重复的数据。 集合对象的编码可以是 intset 或者 hashtable。 Redis 中集合是通过哈希表实现的,所以添加,删除,查找的复杂度都是 O(1)。 集合中最大的成员数为 232 - 1
阅读全文
摘要:const redis = require('redis'); const client = redis.createClient(); // 向集合中添加元素 client.sadd('myset', 'foo', 'bar', 'baz', (err, result) => { console.
阅读全文
摘要:cm@cm:/usr/local/redis/etc sudo vim redis.conf cm@cm:/usr/local/redis/etc$ /etc/init.d/redis status Redis
阅读全文
摘要:redis开启远程服务的操作方法: 1.打开redis的配置文件“redis.conf”。 2.将“bind 127.0.0.1”注释掉。 3.将“protected-mode yes”改成“protected-mode no”。 4.添加以下一行代码。 daemonize no 5.重启redis
阅读全文
摘要:<?php class Red { static private _red = NULL; private $_return_data = NULL; static public function create() { if(self::$redis)
阅读全文
摘要:配置文件: /etc/redis/6379.conf 能"执行命令"的"可执行文件":/etc/init.d/redis_6379 # /etc/init.d/redis_6379 start # /etc/init.d/redis_6379 stop # /etc/init.d/redis_637
阅读全文
摘要:redis 命令: lrange Redis Lrange 返回列表中指定区间内的元素,区间以偏移量 START 和 END 指定。 其中 0 表示列表的第一个元素, 1 表示列表的第二个 元素,以此类推。 你也可以使用负数下标, 以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,
阅读全文
摘要:#查看redis密码 可查看 redis 安装根目录下的配置文件:redis-conf 中 requirepass 后面的内容。 启动redis: /etc/init.d/redis start 关闭redis: redis-cli shutdown
阅读全文
摘要:127.0.0.1:6379> set name jack OK 127.0.0.1:6379> expire jack 20 (integer) 0 127.0.0.1:6379> ttl jack (integer) -2 127.0.0.1:6379> expire name 20 (integer) 1 127.0.0.1:6379> ttl name (integer) 16 127....
阅读全文
摘要:获取 redis 中所有的 key 可用使用 *。 查找所有以GUEST:CART 开头的key 127.0.0.1:6379> keys GUEST:CART*1) "GUEST:CART:19f702e0:e886:431f:9452:63052dd2542b"
阅读全文
摘要:zb@zb-computer:/usr/local/redis/etc bin/redis-cli -p 638
阅读全文
摘要:默认的是6379 可以用6380,6381开启多个 1.开启 ./redis-server ../etc/redis.6380.conf & 2.链接 redis-cli -p 6380 查看进程 # ps aux|grep redis root 866 0.0 0.0 45536 4520 ? S
阅读全文
摘要:2012 ps aux | grep redis 2013 cd /usr/local/redis/ 2014 ls 2015 cd etc/ 2016 ls 2017 cp redis.conf redis.6380.conf 2018 sudo cp redis.conf redis.6380.
阅读全文
摘要:linux环境下,安装redis 操作记录: 回到家目录 cd ~查看 ls进入 lump cd lnmp1.3-fullls??? sudo ./addons.sh // 进入后选择要安装的,输入数字; php -m //查看php安装了哪些东西; ps aux | grep redis //查看
阅读全文
摘要:在 Ubuntu 系统安装 Redi 可以使用以下命令: sudo apt-get install redis-server 启动 Redis redis-cli 以上命令将打开以下终端: r
阅读全文
摘要:redis 127.0.0.1:6379> SELECT 1 # 使用 1 号数据库
阅读全文
摘要:zb@zb-computer:/home/wwwroot/default/lion/Admin$ /usr/local/redis/bin/redis-cli 127.0.0.1:6379> keys * 1) "CAOMALL_doctor::13391840644" keys *
阅读全文