

Redis | 001能做什么?
source link: https://UncleCatMySelf.github.io/2019/02/24/001redis/?amp%3Butm_medium=referral
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

本博客猫叔的博客,转载请申明出处
前言
本系列整理出于《Redis深度历险:核心原理与应用实践》一书,摘抄整理读后感与总结。
好的程序员都会Redis
说说Redis能做什么呢?
- 1、记录帖子的点赞数、评论数和点击数(hash);
- 2、记录用户的帖子ID列表(排序),便于快速显示用户的帖子列表(zset);
- 3、记录帖子的标题、摘要、作者和封面信息,用于列表页展示(hash);
- 4、记录帖子的点赞用户ID列表,评论ID列表,用于显示和去重计数(zset);
- 5、缓存近期热帖内容(帖子内容的空间占用比较大),减少数据库压力(hash);
- 6、记录帖子的相关文章ID,根据内容推荐相关帖子(list);
- 7、如果帖子ID是整数自增的,可以使用Redis来分配帖子ID(计数器);
- 8、收藏集和帖子之间的关系(zset);
- 9、记录热榜帖子ID列表、总热榜和分类热榜(zset);
- 10、缓存用户行为历史,过滤恶意行为(zset、hash);
安装Redis
Redis的安装主要有以下三种方式:
- 1、使用Docker安装;
- 2、通过GitHub源码编译;
- 3、直接安装apt-get install(Ubuntu)、yum install(RedHat)、brew install(Mac)
1、Docker方式
# 拉取 Redis 镜像 > docker pull redis # 运行 Redis 容器 > docker run --name myredis -d -p6379:6379 redis # 执行容器中的 redis-cli 可以直接使用命令行操作 redis > docker exec -it myredis redis-cli
2、GitHub源码编译
# 下载源码 > git clone --branch 2.8 --depth 1 [email protected]:antirez/redis.git > cd redis # 编译 > make > cd src # 运行服务器,daemonize表示在后台运行 > ./redis-server --daemonize yes # 运行命令行 > ./redis-cli
3、直接安装
# mac > brew install redis # ubuntu > apt-get install redis # redhat > yum install redis # 运行客户端 > redis-cli
公众号:Java猫说
现架构设计(码农)兼创业技术顾问,不羁平庸,热爱开源,杂谈程序人生与不定期干货。
Recommend
-
41
公司名称: Hong Kong Applied Science and Technology Research Institute (ASTRI) 工作地点: 香港 薪酬范围: 面议 简历投递: [email protected] 岗位描述、岗位要求: Refere...
-
6
Background I've taken on a new project recently. I'm helping teach some local (Indianapolis) homeless youth basic software engineering using the web developer curriculum from Free Code Camp
-
6
PostMac 001 -- Adding pbcopy to ElementaryOS or Another Unix Nov 5, 2016 Well as will become clear in another few blog posts, I took ElementaryOS and installed it on my 2012 MBP with 16 gigs RAM and 768 mb SSD...
-
12
播放控件的本地化与国际化 | 交互问答 001呆呆只是个会写点字的普通设计师各位好,我是...
-
15
Xcode9的无线调试 Facebook开源库fishhook的使用 UIViewController的调试小工具 自定义导航栏的侧滑返回 QGCollectionMenu简介 Xcode9的无线调试 环境:Xcode9-beta5 iOS-beta5 新的Macbook已经将充...
-
16
QQ 群聊天记录 001 号:关于盗版书的讨论¶ 在我创建的两个技术 QQ 群里面, 时不时会出现一些有趣的讨论内容, 有群友建议我把这些内容记录下来并在网上进行分享, 我一直觉...
-
16
SSQ22667-001: An 80C186 for the Space Station
-
9
PHPLarge -- FuzzyOffice -- 001 - Constraints Aug 9, 2002 PHPLarge :: FuzzyOffice :: 001 - Constraints Last updated: 8/15/2002; 6:20:28 AM The FuzzyBlog...
-
7
Weekend Code Hacker 001 Building a bookmark service with the Django REST framework 02 Sep 2017 I used to be a huge fan of the old Delicious book...
-
9
MySQL基本组成 SQL执行流程
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK