cache count
This commit is contained in:
parent
85ad7ec89a
commit
48d45bfb2f
3 changed files with 9 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
from sanic import Sanic
|
||||
from aiocache import SimpleMemoryCache
|
||||
|
||||
app = Sanic()
|
||||
cache = {}
|
||||
cache = SimpleMemoryCache()
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
import logging
|
||||
import config
|
||||
from sanic import response
|
||||
from aiocache import cached
|
||||
from app import app
|
||||
from app import cache
|
||||
from app.models.site import Site
|
||||
|
@ -44,7 +45,7 @@ def query_comments(request):
|
|||
return r
|
||||
|
||||
|
||||
#@cache.cached(timeout=300)
|
||||
@cached(ttl=300)
|
||||
@app.route("/comments/count", methods=['GET'])
|
||||
def get_comments_count(request):
|
||||
try:
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
aiocache==0.7.0
|
||||
aiofiles==0.3.1
|
||||
aiomcache==0.5.2
|
||||
aioredis==0.3.3
|
||||
clize==2.4
|
||||
hiredis==0.2.0
|
||||
httptools==0.0.9
|
||||
Jinja2==2.7.3
|
||||
Markdown==2.6.2
|
||||
|
@ -9,6 +13,7 @@ PyMySQL==0.6.6
|
|||
PyRSS2Gen==1.1
|
||||
requests==2.7.0
|
||||
sanic==0.5.4
|
||||
Sanic-Cors==0.5.4.2
|
||||
six==1.9.0
|
||||
ujson==1.35
|
||||
uvloop==0.8.0
|
||||
|
|
Loading…
Add table
Reference in a new issue