def get(self): if not cache_repo.get("MOVIES") is None: return cache_repo.get("MOVIES") movie_titles = [] for title in factory.query_db('SELECT DISTINCT(TITLE) FROM MOVIE;'): movie_titles.append(str(title[0])) cache_data = json.dumps(movie_titles) cache_repo.set("MOVIES",cache_data) return cache_repo.get("MOVIES")
def get(self,movie_title): if not cache_repo.get(movie_title) is None: return cache_repo.get(movie_title) objects_list = [] for row in factory.query_db('SELECT LAT,LNG FROM MOVIE WHERE TITLE=:title;', {"title":movie_title}): d = OrderedDict() d['LAT'] = row[0] d['LNG'] = row[1] objects_list.append(d) data = json.dumps(objects_list) cache_repo.set(movie_title, data) return cache_repo.get(movie_title)
def get(self, movie_title): if not cache_repo.get(movie_title) is None: return cache_repo.get(movie_title) objects_list = [] for row in factory.query_db( 'SELECT LAT,LNG FROM MOVIE WHERE TITLE=:title;', {"title": movie_title}): d = OrderedDict() d['LAT'] = row[0] d['LNG'] = row[1] objects_list.append(d) data = json.dumps(objects_list) cache_repo.set(movie_title, data) return cache_repo.get(movie_title)