cache count

pull/6/head
Yax 7 years ago
parent 85ad7ec89a
commit 48d45bfb2f

@ -1,4 +1,5 @@
from sanic import Sanic from sanic import Sanic
from aiocache import SimpleMemoryCache
app = Sanic() app = Sanic()
cache = {} cache = SimpleMemoryCache()

@ -4,6 +4,7 @@
import logging import logging
import config import config
from sanic import response from sanic import response
from aiocache import cached
from app import app from app import app
from app import cache from app import cache
from app.models.site import Site from app.models.site import Site
@ -44,7 +45,7 @@ def query_comments(request):
return r return r
#@cache.cached(timeout=300) @cached(ttl=300)
@app.route("/comments/count", methods=['GET']) @app.route("/comments/count", methods=['GET'])
def get_comments_count(request): def get_comments_count(request):
try: try:

@ -1,5 +1,9 @@
aiocache==0.7.0
aiofiles==0.3.1 aiofiles==0.3.1
aiomcache==0.5.2
aioredis==0.3.3
clize==2.4 clize==2.4
hiredis==0.2.0
httptools==0.0.9 httptools==0.0.9
Jinja2==2.7.3 Jinja2==2.7.3
Markdown==2.6.2 Markdown==2.6.2
@ -9,6 +13,7 @@ PyMySQL==0.6.6
PyRSS2Gen==1.1 PyRSS2Gen==1.1
requests==2.7.0 requests==2.7.0
sanic==0.5.4 sanic==0.5.4
Sanic-Cors==0.5.4.2
six==1.9.0 six==1.9.0
ujson==1.35 ujson==1.35
uvloop==0.8.0 uvloop==0.8.0

Loading…
Cancel
Save