I am learning Redis and I am blocked with the pipelining concept, I am trying to send instruction to my redis server
Do to so I using a socket whitch will connect to the redis server I am using.
Here is my code (I am French so some words will be in french)
def send(MESSAGE):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
s.send(MESSAGE)
data = s.recv(BUFFER_SIZE)
s.close()
print "Envoi requete PC:", MESSAGE
return data
And here is the way I am using the pipelining :
instruction ='SET compteur 0'
donnee = instruction.encode('utf-8') + '\x0D\x0A'
print envoie(donnee)
instruction=''
for i in range(200):
instruction = instruction + 'INCR compteur\r\n'
donnee = instruction.encode('utf-8') + '\x0D\x0A'
print send(donnee)
when I do this, the shell gives me the 200 INCR compteur but it is followed with :
:1
:2
:3
:4
....
:185
:186
:187
:188
:189
Does somebody have an explanation ? Also if I use another instruction for example with a GET compteur, I have only 147 +PONG