Caching example (#150)

* Caching example using aiocache

* Caching example using aiocache

* Added aiocache to requirements

* Fixed example with newest aiocache
This commit is contained in:
Manuel Miranda 2016-11-14 00:11:31 +01:00 committed by Eli Uriegas
parent 49d004736a
commit edb25f799d

View File

@ -15,11 +15,14 @@ import aiocache
from sanic import Sanic
from sanic.response import json
from sanic.log import log
from aiocache import RedisCache, cached
from aiocache import cached
from aiocache.serializers import JsonSerializer
app = Sanic(__name__)
aiocache.set_defaults(cache=RedisCache)
aiocache.settings.set_defaults(
cache="aiocache.RedisCache"
)
@cached(key="my_custom_key", serializer=JsonSerializer())