0

我正在寻找一个具有非常特定功能的程序,希望它存在,所以我不必自己实现它。我可以将这个假设的程序最好地描述为工作目录中文档压缩副本的基于文​​件系统的缓存。我已经制作了一个我希望这个程序做的模型:

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 重复传输。每次请求文件时,我都不想计算压缩率。

如果存在与上述类似的东西,我仍然希望指出正确的方向——我的谷歌搜索非常不成功(也许上述功能有我不知道的术语)。

4

2 回答 2

2

[不可否认,这是在回答“从这个问题开始”的问题]

似乎自己这样做是一个坏主意,您应该让 Web 服务器这样做。

我猜您在 unix 变体上使用 apache,但为了完整起见:

于 2009-12-29T12:51:03.003 回答
0

我想你可以为这种缓存编写相当简单的 PHP 脚本。我不确定这样的事情是否已经存在

于 2009-12-29T12:17:27.707 回答