美文网首页
Redis菜鸟教程(一)

Redis菜鸟教程(一)

作者: 凌雲木 | 来源:发表于2018-04-23 09:19 被阅读350次

1下载安装后启动客户端调试:

cd到安装路径

cd C:\Program Files\Redis

redis-cli.exe -h 127.0.0.1 -p 6379

密码修改:修改配置文件“redis.windows-service.conf

################################## SECURITY ##################

# Require clients to issue AUTH <PASSWORD> before processing any other

# commands. This might be useful in environments in which you do not trust

# others with access to the host running redis-server.

#

# This should stay commented out for backward compatibility and because most

# people do not need auth (e.g. they run their own servers).

#

# Warning: since Redis is pretty fast an outside user can try up to

# 150k passwords per second against a good box. This means that you should

# use a very strong password otherwise it will be very easy to break.

#

# requirepass foobared

requirepass 密码

修改新密码需要重启服务,认证密码

C:\Program Files\Redis>redis-server --service-start

[15236] 17 Mar 08:40:19.111 # Redis service successfully started.

C:\Program Files\Redis>redis-cli.exe -h 127.0.0.1 -p 6379

127.0.0.1:6379> keys *

(error) NOAUTH Authentication required.

127.0.0.1:6379> auth food

OK -------------认证成功

2查看所有key

查看所有key

3判断 key的类型

image.png

4 string 类型数据

1) 设置值set ,取值get

image.png
  1. 修改key的名字
image.png

3)删除key

image.png

4) 查看key是否存在

image.png

5)设置key的过期时间,以秒计算 EXPIRE KEY Second

image.png

6)以秒为单位,返回给定 key 的剩余生存时间(TTL, time to live)。

PTTL key以毫秒为单位返回 key 的剩余的过期时间

image.png

5 LIST列表数据类型

6 哈希数据

6.1 HGETALL key 获取在哈希表中指定 key 的所有字段和值

image.png

6.2 HSET key field value 将哈希表 key 中的字段 field 的值设为 value 。

6.3 设置哈希的过期时间

image.png image.png

哈希 key 设置过期时间后,若哈希值由更改,过期时间原先设置的剩余过期时间不变。若想改变过期时间,需要重新设置。key过期后,Redis中将key自动从Redis数据库中删除。若想继续使用,可以重新创建。

相关文章

  • Redis教程——走马观花

    Redis教程——检视阅读 参考 Redis教程——菜鸟——蓝本——3.2.100 Redis教程——w3c——3...

  • redis安装及基本语法

    Redis Redis 用法参考--菜鸟教程:http://www.runoob.com/redis/redis-...

  • 一些挺不错的博客/学习网址

    Redis学习: 官方文档:redis中文网 基本入门:Redis入门视频教程-慕课网、Redis 教程 | 菜鸟...

  • Redis

    NoSQL 产品(key-value) Redis教程—菜鸟教程 Redis功能介绍 image 企业缓存产品介绍...

  • Lua 教程

    要想学好redis就的会用lua Lua 教程 | 菜鸟教程

  • redis

    参考: 访问有授权验证的 Redis连接池 redis 菜鸟教程 redis tutorial redis red...

  • Redis学习记录

    本人是通过菜鸟教程学习Redis的,本编文章纯属个人做笔记记录而已,大家可以去菜鸟教程学习Redis,比在我这里看...

  • redis各个数据类型的存取

    转自菜鸟教程http://www.runoob.com/redis/redis-tutorial.html 列表:...

  • 6、Express 使用redis读写数据并Promise化

    redis的安装:菜鸟教程:redis安装 redis管理工具:链接:http://pan.baidu.com/s...

  • Redis菜鸟教程(一)

    1下载安装后启动客户端调试: cd到安装路径 cd C:\Program Files\Redis redis-cl...

网友评论

      本文标题:Redis菜鸟教程(一)

      本文链接:https://www.haomeiwen.com/subject/milklftx.html