Skip to content
PAN, Myautsai edited this page Feb 4, 2016 · 11 revisions

Welcome to libmc

libmc is a fast and lightweight memcached client library for C++/Python/Golang without any other dependencies in runtime. The internal part is written in C++, and the Python wrapper and Golang wrapper are written mainly in Cython and cgo.

The python version of libmc can be considered as a drop in replacement for libmemcached and python-libmemcached.

Update: Golang version of libmc is now in beta, checkout golibmc.

Overview

Internal classes:

               Client
                  | (1:1)
            ConnectionPool
                  | (1:N)
              Connection
           /      | (1:1)   \
BufferReader   Parser   BufferWriter
      | (1:N)
  DataBlock
  • Client: top-level API for libmc
  • ConnectionPool:
    1. dispatching different keys to different connections according to key route(Consistent hashing)
    2. multiplexing on top of TCP connections
    3. collecting and merging results from TCP connections
  • Connection: wrapper for TCP connection to each memcached server. Each Connection has one Parser, one BufferReader, and one BufferWriter.
  • BufferReader: buffer helper for receving buffer from memcached server
  • BufferWritter: buffer helper for sending buffer to memcached server
  • DataBlock: wrapper for each continuous memory space

Table of Contents

ALSO SEE

Slide: Reinventing the wheel: libmc