[tech] Questions about cache
Stephen
stephen at drsudo.com
Tue Dec 22 23:31:43 GMT 2020
> There was a thread about this in early November:
>
> https://lists.orbitalfox.eu/archives/gemini/2020/003077.html
>
> It appears that half want caching, half don't. It's a mess.
Well that's embarrassing. I don't know how I missed that *blush*. Thanks
for the link and sorry for the noise.
In case anyone is curious, this is the solution I came up with to
prevent caching. I have a cgi script like this:
if [ -z "$QUERY_STRING" ]; then
printf '30 %s?%s\r\n' \
"$(basename "$SCRIPT_PATH")" \
"$(date | tr ' :' __)"
else
printf '20 text/gemini\r\n'
generate_content
fi
Basically, if there is no query string on the path, it redirects you to
the same page with a cache busting query string constructed from the
current date and time. If there is a query string, it gives you the content.
It's not perfect. A user could bookmark a page with a cache busting
string on it and then see the same static page until it went out of
their cache. I don't think there is a way around that though.
~Stephen
More information about the Gemini
mailing list