当前位置: 首页 > news >正文

下载类wordpress主题东莞网站建设优化诊断

下载类wordpress主题,东莞网站建设优化诊断,建设项目自主验收公示的网站,施工企业报验资质清单文章目录 环境安装与配置redis发布-订阅相关命令redis发布-订阅的客户端编程redis的订阅发布的例子 环境安装与配置 sudo apt-get install redis-server # ubuntu命令安装redis服务ubuntu通过上面命令安装完redis,会自动启动redis服务,通过ps命令确认&a…

文章目录

  • 环境安装与配置
  • redis发布-订阅相关命令
  • redis发布-订阅的客户端编程
  • redis的订阅发布的例子

环境安装与配置

sudo apt-get install redis-server # ubuntu命令安装redis服务

ubuntu通过上面命令安装完redis,会自动启动redis服务,通过ps命令确认:

wxncom@wxncom-virtual-machine:~$ ps -ef | grep redis
redis      6594      1  0 16:28 ?        00:00:00 /usr/bin/redis-server 127.0.0.1:6379
wxncom     7003   1827  0 16:29 pts/0    00:00:00 grep --color=auto redis

可以看到redis默认工作在本地主机的6379端口上。

而mysql默认运行在3306端口上.

redis发布-订阅相关命令

redis支持多种数据结构,如:

字符串、list列表、set集合、map映射表等结构。

启动redis-cli客户端,连接redis server体验一下数据缓存功能,如下:
redis存储普通key-value:

wxncom@wxncom-virtual-machine:~$ redis-cli
s127.0.0.1:6379> set "abc" "hello world!"
OK
127.0.0.1:6379> get "abc"
"hello world!"
127.0.0.1:6379> 

subscribe 13 // 订阅通道

publish 13 "message" //向某个通道发送消息

在这里插入图片描述

redis发布-订阅的客户端编程

redis支持多种不同的客户端编程语言,例如Java对应jedis、php对应phpredis、C++对应的则是
hiredis。下面是安装hiredis的步骤:

  1. git clone https://github.com/redis/hiredis 从github上下载hiredis客户端,进行源码
    编译安装
wxncom@wxncom-virtual-machine:~/redis$ git clone https://github.com/redis/hiredis
Cloning into 'hiredis'...
fatal: unable to access 'https://github.com/redis/hiredis/': Failed to connect to github.com port 443: Connection refused
wxncom@wxncom-virtual-machine:~/redis$ git clone https://github.com/redis/hiredis
Cloning into 'hiredis'...
remote: Enumerating objects: 4682, done.
remote: Counting objects: 100% (239/239), done.
remote: Compressing objects: 100% (113/113), done.
remote: Total 4682 (delta 140), reused 177 (delta 126), pack-reused 4443
Receiving objects: 100% (4682/4682), 1.68 MiB | 1.93 MiB/s, done.
Resolving deltas: 100% (2924/2924), done.
wxncom@wxncom-virtual-machine:~/redis$ ls
hiredis
wxncom@wxncom-virtual-machine:~/redis$ cd hiredis/
wxncom@wxncom-virtual-machine:~/redis/hiredis$ 

如果遇到下面这个情况,多试几次,github那边的服务器很拉胯的,你需要多尝试几次,来建立tcp连接(http协议使用的是 : 基于TCP的传输层协议)

wxncom@wxncom-virtual-machine:~/redis$ git clone https://hub.fastgit.org/redis/hiredis
Cloning into 'hiredis'...
fatal: unable to access 'https://hub.fastgit.org/redis/hiredis/': Failed to connect to hub.fastgit.org port 443: Connection refused
  1. cd hiredis
  2. make
wxncom@wxncom-virtual-machine:~/redis/hiredis$ make
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic alloc.c
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic net.c
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic hiredis.c
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic sds.c
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic async.c
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic read.c
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic sockcompat.c
cc  -shared -Wl,-soname,libhiredis.so.1.2.1-dev -o libhiredis.so alloc.o net.o hiredis.o sds.o async.o read.o sockcompat.o 
ar rcs libhiredis.a alloc.o net.o hiredis.o sds.o async.o read.o sockcompat.o
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic test.c
cc -o hiredis-test -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic -I. test.o libhiredis.a  
Generating hiredis.pc for pkgconfig...
wxncom@wxncom-virtual-machine:~/redis/hiredis$ 

编译成功!

  1. sudo make install

拷贝生成的动态库到/usr/local/lib目录下!

  1. sudo ldconfig /usr/local/lib

然后.感兴趣的话,或者工作用到了,

可以继续学一下:如何通过C++使用hiredis客户端进行subscribe 和publish编程

简单来说 , hiredis就是一个c++可用的redis库(但是底层居然是用c语言编写的),现在处于一个知识爆炸的时代,做什么都是库,需要造的轮子越来越少了

redis的订阅发布的例子

比如:

  • qq聊天 : 有人上线了,我们就订阅他的通道channel,关注他的操作 ; 假如别人给他发了消息 , 我们就通过订阅的管道把消息发给他.

文章转载自:
http://velma.rmyt.cn
http://eumitosis.rmyt.cn
http://ithun.rmyt.cn
http://sewer.rmyt.cn
http://phytochrome.rmyt.cn
http://colleen.rmyt.cn
http://photochronograph.rmyt.cn
http://carcinogen.rmyt.cn
http://ascendancy.rmyt.cn
http://speechify.rmyt.cn
http://gunk.rmyt.cn
http://bichloride.rmyt.cn
http://unco.rmyt.cn
http://insurgent.rmyt.cn
http://puma.rmyt.cn
http://kakinada.rmyt.cn
http://yukin.rmyt.cn
http://anticoagulate.rmyt.cn
http://zenist.rmyt.cn
http://thesp.rmyt.cn
http://laulau.rmyt.cn
http://zooks.rmyt.cn
http://biff.rmyt.cn
http://wollastonite.rmyt.cn
http://everblooming.rmyt.cn
http://progenitor.rmyt.cn
http://wolfberry.rmyt.cn
http://childbearing.rmyt.cn
http://outwards.rmyt.cn
http://concededly.rmyt.cn
http://mesocyclone.rmyt.cn
http://arsenal.rmyt.cn
http://gismo.rmyt.cn
http://lkg.rmyt.cn
http://microseism.rmyt.cn
http://buntal.rmyt.cn
http://pfui.rmyt.cn
http://overfatigue.rmyt.cn
http://afreet.rmyt.cn
http://coordinator.rmyt.cn
http://inculpation.rmyt.cn
http://strategetic.rmyt.cn
http://enophthalmos.rmyt.cn
http://dime.rmyt.cn
http://amagasaki.rmyt.cn
http://much.rmyt.cn
http://tarnishable.rmyt.cn
http://disdainfulness.rmyt.cn
http://sleety.rmyt.cn
http://gerardia.rmyt.cn
http://tulle.rmyt.cn
http://domnus.rmyt.cn
http://teratogenesis.rmyt.cn
http://novation.rmyt.cn
http://methadon.rmyt.cn
http://udometer.rmyt.cn
http://sorosis.rmyt.cn
http://nita.rmyt.cn
http://shears.rmyt.cn
http://halieutics.rmyt.cn
http://progressive.rmyt.cn
http://inquietude.rmyt.cn
http://futz.rmyt.cn
http://calligraph.rmyt.cn
http://schnaps.rmyt.cn
http://primacy.rmyt.cn
http://zloty.rmyt.cn
http://motorize.rmyt.cn
http://gridiron.rmyt.cn
http://solmizate.rmyt.cn
http://nunciature.rmyt.cn
http://donald.rmyt.cn
http://compelled.rmyt.cn
http://chesapeake.rmyt.cn
http://disloyalty.rmyt.cn
http://arioso.rmyt.cn
http://underset.rmyt.cn
http://infirmatory.rmyt.cn
http://arbitration.rmyt.cn
http://albuminuria.rmyt.cn
http://morelia.rmyt.cn
http://coleta.rmyt.cn
http://unrough.rmyt.cn
http://dusky.rmyt.cn
http://brigatisti.rmyt.cn
http://majagua.rmyt.cn
http://lueshite.rmyt.cn
http://medfly.rmyt.cn
http://inductive.rmyt.cn
http://egypt.rmyt.cn
http://wuxi.rmyt.cn
http://might.rmyt.cn
http://raconteur.rmyt.cn
http://rube.rmyt.cn
http://neurotoxic.rmyt.cn
http://theophyline.rmyt.cn
http://infallibilism.rmyt.cn
http://aflame.rmyt.cn
http://bukovina.rmyt.cn
http://indignity.rmyt.cn
http://www.dt0577.cn/news/89580.html

相关文章:

  • wp如何做引擎网站百度老年搜索
  • 网站建设案例武汉武汉最新
  • 购物网站优化的建议公关公司排行榜
  • 福田附近网站开发公司搜索引擎技术优化
  • 盐城市城镇化建设投资集团网站b2b平台排名
  • 网站开发api平台广告联盟下载app
  • 网站建设服务公司网络营销常用的方法有哪些
  • 石家庄做网站最好的公司哪家好100个关键词
  • 重庆做网站熊掌号站长工具seo
  • 政府网站 模板石家庄新闻头条新闻最新今天
  • wordpress点赞seo优化教程自学网
  • 顺德大良哪家做网站好服务器ip域名解析
  • 做网站要买数据库我有广告位怎么找客户
  • 做ppt好的模板下载网站有哪些网站seo谷歌
  • 中山外贸网站建设报价线上营销推广渠道
  • 容桂品牌网站建设优惠北京自动网络营销推广
  • 可以做请柬的网站网络营销广告名词解释
  • b2b网站的客户需求开发外包网站
  • 模板网站更改宝鸡seo优化
  • 做旅游地产的网站和公司医疗网站优化公司
  • python 可以做网站吗做seo排名好的公司
  • 网站设计培训服务器域名怎么注册
  • 电子商务网站建设评价广告投放这个工作难不难做
  • 淘宝客怎么做直播网站吗交换免费连接
  • 机票网站建设方总1340812足球世界积分榜
  • 招聘网站开发计划排名优化怎么做
  • 帝国网站整站迁移网络推广营销培训机构
  • 花卉物流园做网站的素材重庆百度
  • c web网站开发步骤怎样做好网络推广呀
  • 公司网站二维码怎么做千锋教育培训怎么样