lundi 28 novembre 2016

Use hmset / hmget in REDIS: WRONGTYPE Operation against a key holding the wrong kind of value

I am trying to use hmset / hmget to store hashmaps associated to a key in REDIS as such:

def self.store_id_and_phone(key, id, phone)
  REDIS.hmset(key, :id, id, :phone, phone)
  REDIS.expire(key, 15.minutes)
  verification_code_url_key
end

def self.get_id_and_phone(key)
  return REDIS.hmget(key, :id, :phone)
end

However I sometimes get this error at REDIS.hmget

WRONGTYPE Operation against a key holding the wrong kind of value

It doesn't happen all the time tho, about 3% of all the requests.

Did anyone encounter similar issues before? Please shed some light. Thanks!

Aucun commentaire:

Enregistrer un commentaire