biothings.api
biothings.api copied to clipboard
allow customize cache settings
Current default cache
setting (7 days) is defined in BaseAPIHandler
:
https://github.com/biothings/biothings.api/blob/7131379975e8f8aafafa5858ea274dc8181bc863/biothings/web/handlers/base.py#L67
To make it more flexible to customize, we can allow
-
set a global caching time in
config.py
to override the default value.API_HANDLER_CACHE = 3600
-
set caching time on per-handler base, likely in
initialize
method. Similar to howbiothings_type
parameter was set:
https://github.com/biothings/biothings.api/blob/7131379975e8f8aafafa5858ea274dc8181bc863/biothings/web/handlers/query.py#L57
it can be set like:
(r"/api/query/?", "biothings.web.handlers.QueryHandler", {"biothing_type": "schema", "cache": 3600}),