For the life of me I cannot get this use case to work. I'm storing relevant headers in varchar fields and a (pre) gzipped content into a bytea field in a Postgres table called page_cache.
Postgres is favoured over Redis because I can then do atomic cache expiry when a table (optionally plus record id's) change. The performance using OpenResty allows this to be feasible - it turns out that PG is only about 20% slower than Redis - network I/O being the main bottleneck.
I can get the appropriate cache from Postgres and set headers from the fields stored (etag, content type, content length, max age and stuff) but I cannot get it to work storing a pre-gzipped body in a bytea field.
Has anybody got this to work? It seems even storing the content in a text field and dynamically gzipping it per request isn't possible because if the content is server by content_by_lua_file the nginx gzip doesn't happen (or is horribly complex to do?)
Has anyone got something similar to actually work - getting a gzipped field from a table and sending it with the appropriate headers?
Thanks in advance,
Mark.