def get_all_titles(self, name):

        try:
            # get model(s)
            hkeys = self.myRedis.hkeys(name)
            list_title = []

            # build result
            id = [x[:x.find('_')] for x in hkeys]
            title = [x[x.find('_')+1:] for x in hkeys]

            for i in range(len(hkeys)):
                list_title.append({'id': id[i], 'title': title[i]})

            # return result
            if list_title:
                return {'result': list_title, 'error': None}
            else:
                return {
                    'result': None,
                    'error': 'no previous model found in cache'
                }
        except Exception, error:
            self.list_error.append(str(error))
            return {'result': None, 'error': self.list_error}
@get_all_titles
dataset/ETHPy150Open jeff1evesque/machine-learning/brain/cache/cache_model.py/Cache_Model.get_all_titles