Commits

Anonymous committed 4e50b8d

selective cached

  • Participants
  • Parent commits 280dc00

Comments (0)

Files changed (1)

File newsmeme/__init__.py

     
     @app.context_processor
     def get_tags():
-        tags = Tag.query.order_by(Tag.num_posts.desc()).limit(10)
+        return _get_tags()
+
+    @cache.cached()
+    def _get_tags():
+        tags = Tag.query.order_by(Tag.num_posts.desc()).limit(10).all()
         return dict(tags=tags)
 
     @app.context_processor