KorAP / Kalamar

:octopus: Mojolicious-based Frontend for KorAP
BSD 2-Clause "Simplified" License
7 stars 2 forks source link

refresh/invalidate cache button #210

Open remil1000 opened 4 months ago

remil1000 commented 4 months ago

Hello

we're currently spawning the korap/kalamar/kustvakt stack on demand for our internal needs, with the frontend and backend colocated on the same hardware, running as containers.

I'm still unsure how (timeout, empty response, 500 from backend) but in some cases, when a query is done before kustvakt has finished its startup and warmup, we have cases where a invalid response is cached and we can't query this particular term anymore without getting an empty result from cache

This PR is an attempt at adding a simple "refresh" checkbox to invalidate the cache on a query (which could probably also be useful if the backend index is updated without a frontend restart)

PS: I don't really understand the i18n mechanism used so feel free to fix this in the template file

Akron commented 3 months ago

Many thanks for this contribution!

In principle, I have nothing against the inclusion of the feature, but it should be optionally integrated via configuration and not be automatically available for all instances. If you want, I can add a draft to this commit and also integrate the localization accordingly.

However, Kalamar should not cache invalid values that result from incorrect or incomplete responses from the backend, so it would be nice if you could report the error as an issue as soon as it is reproducible. The best way to delete the entire cache as soon as new data has been added to the index is to use

perl script/kalamar chi clear

(or the corresponding command for the running Docker container) as a restart doesn't clear the cache in case it is persistent. Admittedly, this is not well documented.