memcached.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:sauna 作者: NicolasLM 项目源码 文件源码
def _fetch_memcached_stats(self):
        """Connect to Memcached and retrieve stats."""
        data = bytes()
        with socket.create_connection((self.config['host'],
                                       self.config['port']),
                                      timeout=self.config['timeout']) as s:
            s.sendall(b'stats\r\n')
            while True:
                buffer = bytearray(4096)
                bytes_received = s.recv_into(buffer)
                if bytes_received == 0:
                    # Remote host closed connection
                    break
                data += buffer
                if b'\r\nEND\r\n' in data:
                    # End of the stats command
                    break
        return data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号