我正在寻找一个具有非常特定功能的程序,希望它存在,所以我不必自己实现它。我可以将这个假设的程序最好地描述为工作目录中文档压缩副本的基于文件系统的缓存。我已经制作了一个我希望这个程序做的模型:
james@pc:~/htdocs/$ tree -a
.
|-- image.png
`-- index.html
0 directories, 2 files
james@pc:~/htdocs/$ zipcache init
Initialized cache in ./.zipcache/
james@pc:~/htdocs/$ tree -a
.
|-- .zipcache
| |-- gzip
| | `-- index.html.gz
| `-- lzma
| `-- index.html.lzma
|-- image.png
`-- index.html
1 directory, 3 files
james@pc:~/htdocs/$ zipcache gzip index.html
... zipcache emits gzipped copy of index.html on stdout by cat-ing ./.zipcache/gzip/index.html.gz
james@pc:~/htdocs/$ zipcache lzma index.html
... zipcache emits lzma'd copy of index.html on stdout by cat-ing ./.zipcache/lzma/index.html.gz
james@pc:~/htdocs/$ zipcache lzma image.png
... zipcache generates error signifying cache miss (it's intelligent enough to know that PNG shouldn't be further zipped) ...
我最关心的是缓存静态文件的压缩副本,这些副本通过启用内容编码的 HTTP 重复传输。每次请求文件时,我都不想计算压缩率。
如果存在与上述类似的东西,我仍然希望指出正确的方向——我的谷歌搜索非常不成功(也许上述功能有我不知道的术语)。