Cache lib to use with py-easy-rest
pip install py-easy-rest py-easy-rest-redis-cache
Integrating with your py-easy-rest app
#main.py
from py_easy_rest import PYRSanicAppBuilder
from py_easy_rest.service import PYRService
from py_easy_rest_redis_cache import PYRRedisCache
config = {
"name": "Project Name",
"schemas": [{
"name": "Mock",
"slug": "mock",
"properties": {
"name": {"type": "string"},
"age": {"type": "integer"},
},
"required": ["name"],
}]
}
cache = PYRRedisCache("redis://localhost")
service = PYRService(api_config_mock, cache=cache)
sanic_app = PYRSanicAppBuilder.build(api_config_mock, service)
sanic_app.run(
host='0.0.0.0',
port=8000,
debug=True,
)