Here’s the thing: we have a website which has some i18n.
Translations are maintained in DB and manually exported into JSON files which are consumed by our SPA one time on load.
Now I have the following problem to solve: I want to put those i18n JSON files to some CDN and when someone makes updates in database, I would like JSON files to be regenerated automatically and get those uploaded to CDN.
My current thinking is to make Trigger in DB (PostgreSQL) which will send NOTIFY on data change and some service which will listen for that. After this signal it will upload actual JSON to CDN,
Could anyone propose alternative approach?
4
First of all, you need a way to serve the data over HTTP, e.g. a web server accessing your database. Then, you need to use the HTTP cache control headers to ensure that any proxied data is refreshed correctly. To start with, set Last-Modified correctly.
How often are your updates? Are they on a schedule? If they are totally random, use ETag. Otherwise, set Expires appropriately.
HTTP, used correctly, is awesome.
2