predis client class分析

原创 2016年08月31日 14:09:16

Client-> construct

construct -> options, connection, profile, getClientFor->getConnectionById

connection-> connections->create, getConnectionInitializerWrapper/initializer, connections->aggregate->Factory

_call -> executeRaw , createCommand/executeCommand->parseResponse,onErrorResponse(重试逻辑)

ClientContextInterface
pipeline, transaction -> sharedContextFactory, createPipeline / createTransaction

pubSubLoop -> sharedContextFactory, createPubSub->PubSubConsumer
monitor -> MonitorConsumer

重点类
Client 客户端封装类
Options 配置封装类

AbstractConnection 连接类(StreamConnection)->NodeConnectionInterface
AggregateConnectionInterface 组合交互连接

集群交互类(aggregate)
RedisCluster->ClusterStrategy->RedisStrategy(Command->Slot)
PredisCluster->ClusterStrategy->PredisStrategy
SentinelReplication->MaterSlaveReplication->ReplicationStrategy

命令抽象类
Command

功能特性类
Pipeline
Transaction
PubSub
Monitor

辅助类
Cluster Replication 集群策略类
Collection Redis数据结构辅助类
Profile Redis版本信息类
Response 结果处理工具类

协议扩展类
Protocol

RedisCluster类分析
负责处理Redis集群节点的连接管理

sentinel重点关注
SentinelReplication
ReplicationStrategy

接口数据结构分析
client 初始化: options->connections->ReplicationOption->SentinelReplication
建立连接:client->connection(=>SentinelReplication)
->current(getmaster/pickslave=>StreamConnection)->connect()->stream_socket_client();
普通命令:createCommand : client->profile(redisprofile)->createCommand=>Command
executeCommand: client->connection(=>SentinelReplication)
->getConnection(=>StreamConnection)->writeRequest/readResponse
组合命令:pipeline/transaction/PubSubConsumer/MonitorConsumer 共同继承ClientContextInterface
pipeline(callback)-> [pipeline->enqueue()] / executePipeline-> for(writeRequest) / for(readResponse)
哨兵模式:
SentinelReplication:参数sentinels(哨兵地址)和service(实例名称)
工厂类Factory用于创建连接类StreamConnection
策略类ReplicationStrategy用于选择连接节点,辅助判断读写分离
sentinel参数-》sentinel连接-》current/master/slave信息-》校验ROLE-》node连接-》访问数据

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

Redis学习7之Predis连接redis过程和测试

Predis连接redis过程和测试: 1.下载地址:https://github.com/nrk/predis 可以git clone或者下载压缩包再解压到redis的clients文件夹下;2...

从头到尾讲解EJB MDB(消息驱动bean)三——MDB Class、Client 代码规范

七、TheMessage-Driven Bean Class A message drivenbean must be annotated with the MessageDriven annota...

Full Multi-thread Client/Server Socket Class with ThreadPool

Multi-threaded Client/Server Socket Class Screenshots Note: The demo can be started in Client or...

A simple IOCP Server/Client Class

A simple IOCP Server/Client Class

《A Simple IOCP Server/Client Class》整改

CodeProject - 《A Simple IOCP Server/Client Class》 - 整改
  • phunxm
  • phunxm
  • 2011-01-14 23:36
  • 5414

A simple IOCP Server/Client Class

原文地址:http://www.codeproject.com/Articles/10330/A-simple-IOCP-Server-Client-ClassDownload demo projec...

php socket client class

A simple IOCP Server/Client Class

  • 2014-01-08 13:31
  • 155KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)