关键词搜索

源码搜索 ×
×

漫话Redis源码之一百二十二

发布2022-06-19浏览423次

详情内容

在看redis源码时,心中要时刻有rediscontext这个结构体,你可以看到,这个context几乎到处都有,其后的注释是比较明确的:

  1. typedef struct _client {
  2. redisContext *context;
  3. sds obuf;
  4. char **randptr; /* Pointers to :rand: strings inside the command buf */
  5. size_t randlen; /* Number of pointers in client->randptr */
  6. size_t randfree; /* Number of unused pointers in client->randptr */
  7. char **stagptr; /* Pointers to slot hashtags (cluster mode only) */
  8. size_t staglen; /* Number of pointers in client->stagptr */
  9. size_t stagfree; /* Number of unused pointers in client->stagptr */
  10. size_t written; /* Bytes of 'obuf' already written */
  11. long long start; /* Start time of a request */
  12. long long latency; /* Request latency */
  13. int pending; /* Number of pending requests (replies to consume) */
  14. int prefix_pending; /* If non-zero, number of pending prefix commands. Commands
  15. such as auth and select are prefixed to the pipeline of
  16. benchmark commands and discarded after the first send. */
  17. int prefixlen; /* Size in bytes of the pending prefix commands */
  18. int thread_id;
  19. struct clusterNode *cluster_node;
  20. int slots_last_update;
  21. } *client;

看多了,就自然眼熟了,也不要求死记硬背。

相关技术文章

点击QQ咨询
开通会员
返回顶部
×
微信扫码支付
微信扫码支付
确定支付下载
请使用微信描二维码支付
×

提示信息

×

选择支付方式

  • 微信支付
  • 支付宝付款
确定支付下载