python redis client fails to get existing hash values using .hgetall(key) -


i'm encountering circumstance demonstrably known hash in db2 of our redis cache dies when being requested .hgetall(key). i'm hoping insight! thank you.

right, so... first, sliver of code:

def from_cache(self, cachekey):     """ pull oft needed material our persistent redis memory cache, ensuring of course have connection """      try:         log.debug('trying \'%s\' cache' % cachekey)         return self.redis.hgetall(cachekey)     except exception, e:         self.connect_to_cache()         return self.redis.get(cachekey) 

resulting in:

2013-05-21 14:45:26,035 23202 debug trying 'fax:1112223333' cache 2013-05-21 14:45:26,036 23202 debug initializing connection redis/cache memory localhost, port 6379, db 2... 2013-05-21 14:45:26,039 23202 error stopping exception traceback (most recent call last):   file "/usr/lib/python2.6/site-packages/simpledaemon/base.py", line 165, in start     self.run()   file "newgov.py", line 51, in run     if self.ready_for_queue(fax):   file "newgov.py", line 61, in ready_for_queue     if self.too_many_already_queued(fax):   file "newgov.py", line 116, in too_many_already_queued     rules = self.from_cache(key)   file "newgov.py", line 142, in from_cache     return self.redis.get(cachekey)   file "/usr/lib/python2.6/site-packages/redis/client.py", line 588, in     return self.execute_command('get', name)   file "/usr/lib/python2.6/site-packages/redis/client.py", line 378, in execute_command     return self.parse_response(connection, command_name, **options)   file "/usr/lib/python2.6/site-packages/redis/client.py", line 388, in parse_response     response = connection.read_response()   file "/usr/lib/python2.6/site-packages/redis/connection.py", line 309, in read_response     raise response responseerror: operation against key holding wrong kind of value 

and here in redis:

$ redis-cli redis 127.0.0.1:6379> select 2 ok redis 127.0.0.1:6379[2]> type fax:1112223333 hash redis 127.0.0.1:6379[2]> hgetall fax:1112223333 1) "delay" 2) "0" 3) "concurrent" 4) "20" 5) "queued" 6) "20" 7) "exclude" 8) "" 

look @ python stack trace: fails on "return self.execute_command('get', name)". means that:

  • the hgetall command failed (probably because connection not established before)
  • an exception raised , caught in method
  • the redis connection established (i suppose calling connect_to_cache())
  • then try run "self.redis.get(cachekey)"
  • it fails of course because content of cachekey key of hash (not string) (here imagine should use hgetall instead)
  • an other exception raised - redis error type error (operation against key holding wrong kind of value)

with redis-cli, try run "get fax:1112223333", have same error.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -