I plan to gzip and cache html pages in the database. Few parts of the cached page need to be replaced with fresh data when it is served back to user.
Is there away to replace string directly in the gzipped pages without ungzipping them? I am using php
Simple question, simple answer: No it’s not.
It’s because to modify the original data you need to un-gzip the compressed data first, then modify the uncompressed data and then gzip the whole data again. Gzip always compresses a whole chunk of data, so unless you don’t change the whole chunk, you need to uncompress, change and recompress.