flask cache

This commit is contained in:
Yax 2017-07-08 18:53:49 +02:00
parent 657d5400f8
commit 17c302f999
3 changed files with 5 additions and 1 deletions

View file

@ -1,3 +1,5 @@
from flask import Flask
from flask.ext.cache import Cache
app = Flask(__name__)
cache = Cache(app, config={'CACHE_TYPE': 'simple'})

View file

@ -5,6 +5,7 @@ import logging
import config
from flask import request, jsonify, abort
from app import app
from app import cache
from app.models.site import Site
from app.models.comment import Comment
from app.helpers.hashing import md5
@ -45,6 +46,7 @@ def query_comments():
return r
@cache.cached(timeout=300)
@app.route("/comments/count", methods=['GET'])
def get_comments_count():
try: