Esempio n. 1
0
 def value_by_id_list(self, id_list):
     mc_key = self.__mc_id__
     keydict = dict((i, mc_key % i) for i in id_list)
     mcdict = mc.get_dict(keydict.itervalues())
     r = OrderedDict()
     for i in id_list:
         value = mcdict.get(keydict[i])
         if value is None:
             value = self.get(i)
         r[i] = value
     return r
Esempio n. 2
0
 def get_list(self, id_list):
     if type(id_list) not in (array, list, tuple, dict):
         id_list = tuple(id_list)
     mc_key = self.__mc_id__
     result = mc.get_dict([mc_key%i for i in id_list])
     r = []
     for i in id_list:
         t = result.get(mc_key%i)
         if t is None:
             t = self.get(i)
         r.append(t)
     return r