From 784362b5321377b30d001680df71c006754b1871 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sat, 24 Aug 2019 00:24:57 +0200 Subject: [PATCH] Add caching for gzipped response --- core/shared.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/shared.py b/core/shared.py index 6dc7125..5ea6db9 100644 --- a/core/shared.py +++ b/core/shared.py @@ -1,6 +1,7 @@ import gzip import json import os +from functools import lru_cache from functools import wraps from typing import Any @@ -44,6 +45,7 @@ ap.use_backend(back) MY_PERSON = ap.Person(**ME) +@lru_cache(512) def build_resp(resp): """Encode the response to gzip if supported by the client.""" headers = {}