基于文件系统的压缩缓存 - 这是否存在?

时间:2009-12-29 12:03:21

标签: caching compression filesystems http-compression

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

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

如果存在与上述类似的东西,我仍然会指出正确的方向 - 我的Google搜索非常不成功(可能有上述功能的术语,我不知道)。

2 个答案:

答案 0 :(得分:2)

[不可否认,这是回答“一个从这个问题上来”的问题]

看起来自己这样做是个坏主意,你应该让网络服务器这样做。

我猜你在unix变体上使用apache,但为了完整性:

答案 1 :(得分:0)

我猜你可以为这样的缓存编写非常简单的PHP脚本。我不确定这种事情是否存在