WIP: Implement caching
I have implemented very basic cache functionality with Redis. The results are promising so far:
Cold miss:
2020-04-10T23:52:57.992 INFO [gunicorn] [INFO] Request to /api/category/listwithmeta/ took 46.78487777709961 ms with 3 queries.
2020-04-10T23:52:58.105 INFO [gunicorn] [INFO] Request to /api/category/listmetacategories/ took 151.25536918640137 ms with 5 queries.
Cache hit:
2020-04-10T23:53:38.377 INFO [gunicorn] [INFO] Request to /api/category/listwithmeta/ took 2.6569366455078125 ms with 0 queries.
2020-04-10T23:53:38.385 INFO [gunicorn] [INFO] Request to /api/category/listmetacategories/ took 7.293701171875 ms with 0 queries.
Currently I have enabled caching only for /api/category/{listwithmeta,listmetacategories}
endpoints. /api/category/metadata/:category
endpoint could also greatly benefit from caching due to its >40ms query time.
Edited by Emir İşman