title: hset() for redis in python
body: <p>I have next question:</p>
  
  <p>I use the <code>hset()</code> procedure for Redis Server in python. This procedure is described <a href="http://redis-py.readthedocs.org/en/latest/#redis.StrictRedis.hset" rel="noreferrer">here</a>. </p>
  
  <p>ok, now I couldn't understand the parameter <code>value</code>... From one hand it should be a number 0 or 1, anyway I could use also other numbers for this parameter (and I also find examples in net with other values). For example I define next def:</p>
  
  <pre><code>    def setHashKeyValue(key, value, number):
          assert (key != None), "Please, get a key"
          #assert (number == 0 or number ==1), "Please enter 0 or 1"
          redis_server.hset(key, value, number);
  </code></pre>
  
  <p>And got right output with the next parameters:</p>
  
  <pre><code>setHashKeyValue('5', 'test ok for key 5', 1)
  setHashKeyValue('6', 'test ok for key 6', 1)
  </code></pre>
  
  <p>On the other hand, I would like to define some loop for time measuring, so I define next def:</p>
  
  <pre><code>def loopKeyValues(number):
      timeUse = []
      for x in range(number):
          start = time.time()
          setHashKeyValue(x, x**2, 1)
          end = time. time()
          timeUse.append(end-start)
      plt.plot(timeUse)
      plt.ylabel("time")
      plt.show()
      return timeUse;
  </code></pre>
  
  <p>and </p>
  
  <pre><code>print loopKeyValues(1000)
  </code></pre>
  
  <p>This function return me an error message for HashValue:</p>
  
  <pre><code>redis.exceptions.ResponseError: WRONGTYPE Operation against a key holding the wrong kind of value
  </code></pre>
  
  <p>When I use <code>set()</code>-def instead of <code>hset()</code>, the program return me a nice time plot. What could be a problem here and what means the parameter <code>value</code>?</p>