flask cache
This commit is contained in:
parent
a22ef97970
commit
19655b24df
3 changed files with 5 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
|||
from flask import Flask
|
||||
from flask.ext.cache import Cache
|
||||
|
||||
app = Flask(__name__)
|
||||
cache = Cache(app, config={'CACHE_TYPE': 'simple'})
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
clize==2.4
|
||||
Flask==0.10.1
|
||||
Flask-Cache==0.13.1
|
||||
Flask-Cors==2.0.1
|
||||
itsdangerous==0.24
|
||||
Jinja2==2.7.3
|
||||
|
@ -11,4 +12,3 @@ PyRSS2Gen==1.1
|
|||
requests==2.7.0
|
||||
six==1.9.0
|
||||
Werkzeug==0.10.4
|
||||
wheel==0.24.0
|
||||
|
|
Loading…
Add table
Reference in a new issue