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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue