4 ms·
> Go isn't perfect either. The author isn't dealing with assets (images anyone?). From the article: "The Go web application had all files like configurations (
by acatton 4y ago
> Go isn't perfect either. The author isn't dealing with assets (images anyone?).
From the article: "The Go web application had all files like configurations (no credentials), static css and html templates embedded with embedfs (and proxied through a CDN)."
See https://pkg.go.dev/embed https://pkg.go.dev/embed
- zer00eyz 4y agoOP here, How are you doing caching without a mod time? https://github.com/golang/go/issues/44854 https://github.com/golang/go/issues/44854 Are you re-naming or hashing for cache clearing?
- acatton 4y agoI'm not the author of the post, so I can't tell you what the author does. What I do in my projects is that I tell varnish-cache to cache assets in "/static/..." forever. And I have a "curl -X PURGE <varnish_endpoint>" as part of the "ExecStartPre=" of my go binary. • https://varnish-cache.org/docs/trunk/users-guide/purging.html#http-purging https://varnish-cache.org/docs/trunk/users-guide/purging.htm... • https://www.freedesktop.org/software/systemd/man/systemd.service.html#ExecStartPre= https://www.freedesktop.org/software/systemd/man/systemd.ser...
- ed25519FUUU 4y agoClever solution! Why not make it part of the startup of your binary?
- acatton 4y agoSorry to reply a day later. GP here, it's a simple separation of concern. IMHO the binary should not be aware that it is cached and/or how it's deployed. I separate "business logic" from "devops", and I consider purging the cache to be "devops". This is why I let systemd do it. Of course, at the end it's a question of preference. People might disagree.