add default value for hash.get

parent 172c6678
......@@ -390,9 +390,12 @@ class HashSetting(object):
return ttl_func(self._cnx(),self._name,value)
def get(self,key) :
def get(self,key,default = None) :
cnx = self._cnx()
return cnx.hget(self._name,key)
return_val = cnx.hget(self._name,key)
if return_val is None:
return_val = default
return return_val
def pop(self,key) :
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment